diff --git a/types/lunr/index.d.ts b/types/lunr/index.d.ts index 9350d20f8f..950ed6f48e 100644 --- a/types/lunr/index.d.ts +++ b/types/lunr/index.d.ts @@ -131,10 +131,10 @@ declare namespace lunr { * importance when ranking search results. Use a field boost to specify that matches * within one field are more important than other fields. * - * @param field - The name of a field to index in all documents. + * @param fieldName - The name of a field to index in all documents. * @param attributes - Optional attributes associated with this field. */ - field(field: string, attributes?: object): void; + field(fieldName: string, attributes?: { boost?: number, extractor?: (doc: object) => string | object | object[] }): void; /** * A parameter to tune the amount of field length normalisation that is applied when @@ -171,7 +171,7 @@ declare namespace lunr { * @param doc - The document to add to the index. * @param attributes - Optional attributes associated with this document. */ - add(doc: object, attributes?: object): void; + add(doc: object, attributes?: { boost?: number }): void; /** * Builds the index, creating an instance of lunr.Index. diff --git a/types/lunr/lunr-tests.ts b/types/lunr/lunr-tests.ts index 4d3fa57461..f83b6ff921 100644 --- a/types/lunr/lunr-tests.ts +++ b/types/lunr/lunr-tests.ts @@ -22,6 +22,7 @@ function basic_test() { title: "Bar", body: "Bar bar bar!" }); + this.use((builder: lunr.Builder) => builder.field("text")); }); index.search("foo");