Commit feea8f97 authored by Gabriela Bittencourt's avatar Gabriela Bittencourt
Browse files

Add priority in search query and add word expansion

Chosen priority: title > keywords > description. The chosen weights
(boost parameters) were chosen arbitrarily based on manual iterations
and could be improved.

Word expansion was enabled in title and keywords fields to allow
matching of parts of a word.
parent adbdc1b6
......@@ -858,7 +858,13 @@ function doc_search() {
clear_results();
text_elem.blur();
toc_bookmark_status(false);
results = index.search(search_text);
results = index.search(search_text, {
fields: {
title: {boost: 64, expand: true},
keywords: {boost: 8, expand: true},
description: {boost: 1}
}
});
for (i = 0; i < results.length; i++) {
doc = index.documentStore.getDoc(results[i].ref);
display_doc(doc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment