mirror of
https://github.com/simon987/od-database.git
synced 2025-04-24 12:45:51 +00:00
Refresh index before reddit comment callback
This commit is contained in:
parent
8ffd9179d2
commit
ffeed4192e
@ -58,6 +58,7 @@ class RedditCommentCallback(RedditCallback):
|
|||||||
comment_id = self.task.callback_args["comment_id"]
|
comment_id = self.task.callback_args["comment_id"]
|
||||||
print("Editing comment comment " + comment_id)
|
print("Editing comment comment " + comment_id)
|
||||||
|
|
||||||
|
search.refresh() # Make sure the newly indexed documents are available before commenting
|
||||||
stats = search.get_stats(self.task.website_id)
|
stats = search.get_stats(self.task.website_id)
|
||||||
message = self.reddit_bot.get_comment(stats, self.task.website_id,
|
message = self.reddit_bot.get_comment(stats, self.task.website_id,
|
||||||
message="There you go! This website was crawled in `" +
|
message="There you go! This website was crawled in `" +
|
||||||
|
@ -31,6 +31,9 @@ class SearchEngine:
|
|||||||
def get_stats(self, website_id: int, subdir: str = None):
|
def get_stats(self, website_id: int, subdir: str = None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class ElasticSearchEngine(SearchEngine):
|
class ElasticSearchEngine(SearchEngine):
|
||||||
SORT_ORDERS = {
|
SORT_ORDERS = {
|
||||||
@ -460,3 +463,6 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
for website in websites:
|
for website in websites:
|
||||||
if website not in non_empty_websites:
|
if website not in non_empty_websites:
|
||||||
yield website
|
yield website
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
self.es.indices.refresh(self.index_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user