|
|
@@ -182,14 +182,17 @@ class db():
|
|
|
return False
|
|
|
|
|
|
def update_keyword(self, kw):
|
|
|
- if 'keyword' not in kw or 'weight' not in kw:
|
|
|
+ if 'oldkw' not in kw or 'weight' not in kw or 'newkw' not in kw:
|
|
|
return False
|
|
|
|
|
|
if not isinstance(kw['weight'], int):
|
|
|
return False
|
|
|
+
|
|
|
kwdb = self.c_kw
|
|
|
try:
|
|
|
- kwdb.update({'keyword': kw['keyword']}, {'$set': kw})
|
|
|
+ kwdb.update({'keyword': kw['oldkw']},
|
|
|
+ {'$set':
|
|
|
+ {'weight': kw['weight'], 'keyword': kw['newkw']}})
|
|
|
return True
|
|
|
except Exception:
|
|
|
print("Dup KW")
|