The LIFTI query syntax
There are two ways to query a
FullTextIndex, searching with a query string and executing a manually constructed
Searching with text
This approach uses the
IQueryParser implementation configured for the index to parse the query text into a
Query object, which is then executed.
IQueryParser that is configured against an index parses the LIFTI query syntax, which is a fairly flexible way of expressing a query. If you want to swap out this parser with a custom implementation, you can do so when building the index using
Searching with a
You can manually construct a
Query using any combination of
IQueryParts, but take care to normalize any text to match in the same way that it has been indexed. You can do this using either the
ITokenizer for the index, or if specific tokenization rules have been configured for a field, then the tokenizer for that field:
var tokenizer = index.DefaultTokenizer; var query = new Query( new AndQueryPart( new ExactWordQueryPart(tokenizer.Normalize("hello")), new ExactWordQueryPart(tokenizer.Normalize("there"))));
Instead of using a query parser to interpret your query, you can manually construct a
Query object and execute it against the index.
You can use an IndexNavigator to navigate the index character by character.
FullTextIndex<T>.Search are an enumeration of