[lunr] Refine Builder.fieid argument type (#43044)

This commit is contained in:
mtgto 2020-04-01 07:37:54 +09:00 committed by GitHub
parent 8379f5d24f
commit bcba5e2eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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.

View File

@ -22,6 +22,7 @@ function basic_test() {
title: "Bar",
body: "Bar bar bar!"
});
this.use((builder: lunr.Builder) => builder.field("text"));
});
index.search("foo");