 | IFulltextQueryTDocumentOptions Method |
Change the options used for this query.
Namespace:
SphinxConnector.FluentApi
Assembly:
SphinxConnector (in SphinxConnector.dll) Version: 5.4.1
SyntaxIFulltextQuery<TDocument> Options(
Action<IFulltextQueryOptions<TDocument>> optionSetter
)
Function Options (
optionSetter As Action(Of IFulltextQueryOptions(Of TDocument))
) As IFulltextQuery(Of TDocument)
Parameters
- optionSetter
- Type: SystemActionIFulltextQueryOptionsTDocument
A function to set the options.
Return Value
Type:
IFulltextQueryTDocumentThe current instance.
Examples
Suppose you have the following class representing a document in your index:
And you want to set a custom field weight for the name attribute and set max matches to 50:
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
var results = fulltextSession.Query<Product>().
Match("a product").
Options(o => o.FieldWeight(x => x.Name, 1000).
MaxMatches(50)).
ToList();
}
See Also