WithField(string, FieldType) Method
Defines a search field and whether to include it in results.
Namespace
Statiq.Lunr
Containing Type
GenerateLunrIndex

Syntax

public GenerateLunrIndex WithField(string key, FieldType fieldType)

Remarks

The key corresponds to a key from the items returned from WithSearchItems(Config<IEnumerable<IEnumerable<KeyValuePair<string, object>>>>), or from the input documents by default.

Including the field in the results (Result) increases the size of the JSON file that contains result data, but allows using the value of the field from the client. Otherwise, just specifying Searchable will allow searching the field value but not using it from the client. You can also specify both since FieldType is a FlagsAttribute enum.

Parameters

Name Type Description
key string The key that holds the search value.
fieldType FieldType The type of field.

Return Value

Type Description
GenerateLunrIndex The current module instance.