diff --git a/analyse/search.py b/analyse/search.py index 4bc3b72..8f0f1de 100644 --- a/analyse/search.py +++ b/analyse/search.py @@ -18,7 +18,7 @@ def run(): with TinyIndex(Document, INDEX_PATH) as tiny_index: completer = Completer() ranker = HeuristicRanker(tiny_index, completer) - items = ranker.search('jasper fforde') + items = ranker.search('jasper fforde', []) print() if items: for i, item in enumerate(islice(items, 10)): diff --git a/devdata/index-v2.tinysearch b/devdata/index-v2.tinysearch index d7a3690..e4316e9 100644 Binary files a/devdata/index-v2.tinysearch and b/devdata/index-v2.tinysearch differ diff --git a/front-end/assets/css/global.css b/front-end/assets/css/global.css index 5e3a4c5..c85945a 100644 --- a/front-end/assets/css/global.css +++ b/front-end/assets/css/global.css @@ -148,6 +148,13 @@ body { font-size: .9rem; } +.via { + font-size: .9rem; + font-weight: var(--default-font-weight); + /* italics */ + font-style: italic; +} + .result .title, .result .title>* { color: var(--primary-color); font-size: 1.1rem; diff --git a/mwmbl/format.py b/mwmbl/format.py index ad8f2ef..56df6d3 100644 --- a/mwmbl/format.py +++ b/mwmbl/format.py @@ -3,7 +3,7 @@ import re from mwmbl.tokenizer import tokenize, clean_unicode -def format_result_with_pattern(pattern, result): +def format_result_with_pattern(pattern, result, source): formatted_result = {} for content_type, content_raw in [('title', result.title), ('extract', result.extract)]: content = clean_unicode(content_raw) @@ -17,6 +17,7 @@ def format_result_with_pattern(pattern, result): content_result.append({'value': content[start:end], 'is_bold': is_bold}) formatted_result[content_type] = content_result formatted_result['url'] = result.url + formatted_result['source'] = source return formatted_result @@ -34,8 +35,8 @@ def get_query_regex(terms, is_complete, is_url): return pattern -def format_result(result, query): +def format_result(result, query, source): tokens = tokenize(query) pattern = get_query_regex(tokens, True, False) - return format_result_with_pattern(pattern, result) + return format_result_with_pattern(pattern, result, source) diff --git a/mwmbl/templates/result.html b/mwmbl/templates/result.html index 6b5a634..339d293 100644 --- a/mwmbl/templates/result.html +++ b/mwmbl/templates/result.html @@ -3,7 +3,7 @@