Tweaked the foundWords array for #85
This commit is contained in:
@@ -266,10 +266,20 @@ export async function getSuggestions(
|
|||||||
// Clean search matches that match quoted expressions,
|
// Clean search matches that match quoted expressions,
|
||||||
// and inject those expressions instead
|
// and inject those expressions instead
|
||||||
const foundWords = [
|
const foundWords = [
|
||||||
...Object.keys(result.match).filter(w =>
|
// Matching terms from the result,
|
||||||
query.segments.some(s => w.startsWith(s.value)),
|
// do not necessarily match the query
|
||||||
),
|
...Object.keys(result.match),
|
||||||
|
|
||||||
|
// // Matching terms from the query,
|
||||||
|
// // but only if they stem from the result's matches
|
||||||
|
// ...Object.keys(result.match).filter(w =>
|
||||||
|
// query.segments.some(s => w.startsWith(s.value)),
|
||||||
|
// ),
|
||||||
|
|
||||||
|
// Quoted expressions
|
||||||
...query.segments.filter(s => s.exact).map(s => s.value),
|
...query.segments.filter(s => s.exact).map(s => s.value),
|
||||||
|
|
||||||
|
// Tags, starting with #
|
||||||
...tags,
|
...tags,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user