Update elasticlunr Types (#46986)

Update the elasticlunr types, to have the expand option
in the correct place not within fields.
https://github.com/gatsby-contrib/gatsby-plugin-elasticlunr-search#partial-searches
This commit is contained in:
Haseeb Majid 2020-09-24 21:31:47 +01:00 committed by GitHub
parent 01079a9b7d
commit 99f0e71149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -37,7 +37,7 @@ index.coordNorm({ doc: 1 }, { doc: ['token'] }, 1);
index.fieldSearch(['ok'], 'field', { field: { boost: 10 } });
index.fieldSearch(['ok'], 'field', { field: { boost: 10, bool: 'OR' } });
index.fieldSearch(['ok'], 'field', { field: { boost: 10, bool: 'AND' } });
index.fieldSearch(['ok'], 'field', { field: { boost: 10, expand: true } });
index.fieldSearch(['ok'], 'field', { field: { boost: 10 } });
index.fieldSearchStats({ doc: ['ok'] }, 'ok', { doc: testDoc });
@ -73,6 +73,10 @@ index.search('query', {
},
});
index.search('query', {
expand: true
});
index.toJSON();
index.updateDoc(testDoc);

View File

@ -91,12 +91,12 @@ declare namespace elasticlunr {
[K in keyof T]?: {
bool?: Bool;
boost?: number;
expand?: boolean;
};
};
interface SearchConfig<T> {
fields?: FieldSearchConfig<T>;
expand?: boolean;
}
interface SerialisedInvertedIndex {