diff --git a/src/Query/index.ts b/src/Query/index.ts index 9c90b9c..3808891 100644 --- a/src/Query/index.ts +++ b/src/Query/index.ts @@ -11,7 +11,17 @@ function processPart(part: string): string[] { return tokenize(part, false); } -const BURIED_PROPERTIES = ['realm']; +const BURIED_PROPERTIES = [ + 'realm', + 'AtlasGov-master', + 'php-library-current', + 'php-library-master', + 'php-library-upcoming', + 'php-library-v1.16', + 'docs-php-library-fix-search', + 'docs-php-library-master', +]; + const BURIED_FACTOR = 0.8; // each $search operator is expanded into two compound operators so that certain properties are buried @@ -115,10 +125,10 @@ export class Query { ...boostedStrings.map((boostedString, i) => ({ text: { path: 'strippedSlug', - query: [boostedString], + query: boostedString, // Boost each entry slightly higher than the next so that entry // order is respected in results - score: { boost: { value: 100 + 10 * (boostedStrings.length - i) } }, + score: { boost: { value: 1000000 + 10 * (boostedStrings.length - i) } }, }, })) ); @@ -331,6 +341,7 @@ export class Query { tracking: { searchTerms: this.rawQuery, }, + scoreDetails: true, }, }, ]; diff --git a/src/Query/types.ts b/src/Query/types.ts index 16366cd..1aa38ea 100644 --- a/src/Query/types.ts +++ b/src/Query/types.ts @@ -16,7 +16,7 @@ export type Score = { export type Part = { text: { path: Path | Path[]; - query: string[]; + query: string | string[]; score?: Score; synonyms?: string; };