Skip to content

Commit

Permalink
handle queries differently between title and text
Browse files Browse the repository at this point in the history
A match on `title` gets a boost of 10, just like the original
implementation. Furthermore the pipeline is not used for `title`.
Trailing wildcards did not seem to work well with the other options, so
they are off.
  • Loading branch information
visr committed Sep 25, 2017
1 parent 18a6d58 commit 2533ae5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion assets/html/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,18 @@ require(["jquery", "lunr"], function($, lunr) {
results = index.query(function (q) {
tokens.forEach(function (t) {
q.term(t.toString(), {
editDistance: 2
fields: ["title"],
boost: 10,
usePipeline: false,
editDistance: 2,
wildcard: lunr.Query.wildcard.NONE
})
q.term(t.toString(), {
fields: ["text"],
boost: 1,
usePipeline: true,
editDistance: 2,
wildcard: lunr.Query.wildcard.NONE
})
})
})
Expand Down

0 comments on commit 2533ae5

Please sign in to comment.