From 99f0e711490ada251cb13249e6fc23ff3ba2c763 Mon Sep 17 00:00:00 2001 From: Haseeb Majid Date: Thu, 24 Sep 2020 21:31:47 +0100 Subject: [PATCH] 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 --- types/elasticlunr/elasticlunr-tests.ts | 6 +++++- types/elasticlunr/index.d.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/elasticlunr/elasticlunr-tests.ts b/types/elasticlunr/elasticlunr-tests.ts index 3c12c1d46b..c4da205880 100644 --- a/types/elasticlunr/elasticlunr-tests.ts +++ b/types/elasticlunr/elasticlunr-tests.ts @@ -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); diff --git a/types/elasticlunr/index.d.ts b/types/elasticlunr/index.d.ts index ed8b6da09d..de4dd5e327 100644 --- a/types/elasticlunr/index.d.ts +++ b/types/elasticlunr/index.d.ts @@ -91,12 +91,12 @@ declare namespace elasticlunr { [K in keyof T]?: { bool?: Bool; boost?: number; - expand?: boolean; }; }; interface SearchConfig { fields?: FieldSearchConfig; + expand?: boolean; } interface SerialisedInvertedIndex {