some minor changes for search

* change search weights
* change indentation for contents

Signed-off-by: Toshaan Bharvani <toshaan@vantosh.com>
newmemberlevels
Toshaan Bharvani 3 years ago
parent 5878432815
commit fd09731bb9

@ -1,4 +1,4 @@
summaryInclude=0; summaryInclude=100;
var fuseOptions = { var fuseOptions = {
shouldSort: true, shouldSort: true,
includeMatches: true, includeMatches: true,
@ -9,9 +9,9 @@ var fuseOptions = {
maxPatternLength: 32, maxPatternLength: 32,
minMatchCharLength: 1, minMatchCharLength: 1,
keys: [ keys: [
{ name: "title" , weight: 0.8 }, { name: "title" , weight: 0.9 },
{ name: "tags" , weight: 0.7 },
{ name: "contents" , weight: 0.5 }, { name: "contents" , weight: 0.5 },
{ name: "tags" , weight: 0.3 },
{ name: "categories" , weight: 0.3 } { name: "categories" , weight: 0.3 }
] ]
}; };
@ -62,10 +62,10 @@ function populateResults(result){
if(mvalue.key == "tags" || mvalue.key == "categories") { if(mvalue.key == "tags" || mvalue.key == "categories") {
snippetHighlights.push(mvalue.value); snippetHighlights.push(mvalue.value);
} else if(mvalue.key == "contents") { } else if(mvalue.key == "contents") {
start = mvalue.indices[0][0]-summaryInclude>0?mvalue.indices[0][0]-summaryInclude:0; start = mvalue.indices[0][0]-summaryInclude>0?mvalue.indices[0][0]-summaryInclude:0;
end = mvalue.indices[0][1]+summaryInclude<contents.length?mvalue.indices[0][1]+summaryInclude:contents.length; end = mvalue.indices[0][1]+summaryInclude<contents.length?mvalue.indices[0][1]+summaryInclude:contents.length;
snippet += contents.substring(start,end); snippet += contents.substring(start,end);
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0],mvalue.indices[0][1]-mvalue.indices[0][0]+1)); snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0],mvalue.indices[0][1]-mvalue.indices[0][0]+1));
} }
}); });
} }

Loading…
Cancel
Save