Rev3817, Support limits for feed search

This commit is contained in:
shortcutme 2019-01-25 14:26:38 +01:00
parent be36a20249
commit 276cbc0ace
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 8 additions and 3 deletions

View file

@ -104,7 +104,7 @@ class UiWebsocketPlugin(object):
filters = {}
return [search_text, filters]
def actionFeedSearch(self, to, search):
def actionFeedSearch(self, to, search, limit=30, day_limit=30):
if "ADMIN" not in self.site.settings["permissions"]:
return self.response(to, "FeedSearch not allowed")
@ -152,9 +152,14 @@ class UiWebsocketPlugin(object):
if filters.get("type") and filters["type"] not in query:
continue
if day_limit:
db_query.wheres.append(
"%s > strftime('%%s', 'now', '-%s day')" % (db_query.fields.get("date_added", "date_added"), day_limit)
)
# Order
db_query.parts["ORDER BY"] = "date_added DESC"
db_query.parts["LIMIT"] = "30"
db_query.parts["LIMIT"] = str(limit)
res = site.storage.query(str(db_query), params)
except Exception, err:

View file

@ -13,7 +13,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.6.4"
self.rev = 3815
self.rev = 3817
self.argv = argv
self.action = None
self.pending_changes = {}