diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/khanindexer.py | 60 | ||||
-rw-r--r-- | src/settings.yml | 4 |
2 files changed, 0 insertions, 64 deletions
diff --git a/src/khanindexer.py b/src/khanindexer.py deleted file mode 100644 index 36dd1ef..0000000 --- a/src/khanindexer.py +++ /dev/null @@ -1,60 +0,0 @@ -# khanindexer -# -# @website https://git.khaganat.net/neodarz/khanindexer -# -# @results JSON -# @stable yes -# @parse (general) url, title, content - -from urllib import urlencode -import json - -# engine dependent config -categories = ['general'] # TODO , 'images', 'music', 'videos', 'files' -paging = False -language_support = False -number_of_results = 5 - -# do search-request -def request(query, params): - - params['data'] = json.dumps({ - "index": "neodarznet", - "query": { "match": { "_all": query } }, - "highlight": - { - "fields": { - "content": {}, - "url": {}, - "title": {} - }, - "pre_tags": "_", - "post_tags": "_" - } - }) - - params['method'] = 'POST' - - params['url'] = 'http://127.0.0.1:8080/json/search' - - return params - - -# get response from search-request -def response(resp): - results = [] - - datas = json.loads(resp.text) - - if not 'error' in datas: - for el in datas['hits']['hits']: - results.append({ - 'title': el["_source"]["title"], - 'content': el["highlight"]["content"][0], - 'url': el["_source"]["url"] - }) - else: - print("ERROR:Search server: "+str(datas['error'])) - - # return results - return results diff --git a/src/settings.yml b/src/settings.yml index 0245ea1..243166d 100644 --- a/src/settings.yml +++ b/src/settings.yml @@ -65,10 +65,6 @@ engines: engine: khaganatForum shortcut: kf - - name: khanindexer - engine: khanindexer - shortcut: kh - - name: khanindexer-nevrax engine: khanindexer-nevrax shortcut: khn |