|
|
@@ -33,7 +33,8 @@ class db():
|
|
|
|
|
|
|
|
|
|
|
|
- db_filter["weight"]={"$gt":int(filter["minweight"])}
|
|
|
+ if "minweight" in filter and filter != "":
|
|
|
+ db_filter["weight"]={"$gt":int(filter["minweight"])}
|
|
|
|
|
|
print(db_filter)
|
|
|
#{'site': 'site', 'mindate': 'mind', 'maxddate': 'maxd', 'minweight': 'minwe'}
|
|
|
@@ -66,6 +67,9 @@ class db():
|
|
|
print("Dup")
|
|
|
return False
|
|
|
|
|
|
+ def purge_error(self):
|
|
|
+ self.c_articles.remove({'error':True})
|
|
|
+
|
|
|
def article_exists(self,url):
|
|
|
ret=self.c_articles.find_one({'url':url})
|
|
|
if ret is None:
|
|
|
@@ -74,9 +78,12 @@ class db():
|
|
|
|
|
|
def lower_arr(self,arr):
|
|
|
return [a.lower() for a in arr]
|
|
|
- def get_keywords(self,category):
|
|
|
+ def get_keywords_list(self):
|
|
|
kw=self.client[self.DB]["keywords"]
|
|
|
- #FIXME, split on "|" or regex
|
|
|
+ return [ k["keyword"] for k in kw.find({}) ]
|
|
|
+
|
|
|
+ def get_keywords(self,category):
|
|
|
+ kw=self.client[self.DB]["keywords"] #FIXME, split on "|" or regex
|
|
|
ret = [ {"weight":k["weight"],
|
|
|
"kw": k["keyword"],
|
|
|
"pattern": self.lower_arr(k["keyword"].split("|")) } for k in kw.find({}) ]#FIXME, categories
|