change term presence in lunr query

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Emma Indal
2021-05-19 21:50:59 +02:00
committed by Eric Peterson
parent 982849c5b7
commit af6a718e82
@@ -44,6 +44,7 @@ export class LunrSearchEngine implements SearchEngine {
types,
}: SearchQuery): ConcreteLunrQuery => {
let lunrQueryFilters;
const lunrTerm = term ? `+${term}` : '';
if (filters) {
lunrQueryFilters = Object.entries(filters)
.map(([key, value]) => ` +${key}:${value}`)
@@ -51,7 +52,7 @@ export class LunrSearchEngine implements SearchEngine {
}
return {
lunrQueryString: `${term}${lunrQueryFilters || ''}`,
lunrQueryString: `${lunrTerm}${lunrQueryFilters || ''}`,
documentTypes: types || ['*'],
};
};