From 9cd6c506ae0fc02f9bcbbf912867ec86b2ab025f Mon Sep 17 00:00:00 2001 From: TheAMM Date: Fri, 26 May 2017 16:12:47 +0300 Subject: [PATCH] Update ElasticSeach index and scripts for comment_count --- es_mapping.yml | 2 ++ import_to_es.py | 1 + sync_es.py | 1 + 3 files changed, 4 insertions(+) diff --git a/es_mapping.yml b/es_mapping.yml index 1fc72ad..3490fd9 100644 --- a/es_mapping.yml +++ b/es_mapping.yml @@ -91,6 +91,8 @@ mappings: type: long seed_count: type: long + comment_count: + type: long # these ids are really only for filtering, thus keyword uploader_id: type: keyword diff --git a/import_to_es.py b/import_to_es.py index 106cbc1..6832781 100755 --- a/import_to_es.py +++ b/import_to_es.py @@ -51,6 +51,7 @@ def mk_es(t): "uploader_id": t.uploader_id, "main_category_id": t.main_category_id, "sub_category_id": t.sub_category_id, + "comment_count": t.comment_count, # XXX all the bitflags are numbers "anonymous": bool(t.anonymous), "trusted": bool(t.trusted), diff --git a/sync_es.py b/sync_es.py index cafafb5..2f2bb09 100755 --- a/sync_es.py +++ b/sync_es.py @@ -86,6 +86,7 @@ def reindex_torrent(t, index_name): "uploader_id": t['uploader_id'], "main_category_id": t['main_category_id'], "sub_category_id": t['sub_category_id'], + "comment_count": t['comment_count'], # XXX all the bitflags are numbers "anonymous": bool(f & TorrentFlags.ANONYMOUS), "trusted": bool(f & TorrentFlags.TRUSTED),