Namespace Lucene.Net.QueryParsers.Flexible.Standard
Classes
QueryParserUtil
This class defines utility methods to (help) parse query strings into Query objects.
StandardQueryParser
This class is a helper that enables users to easily use the Lucene query parser.
To construct a Query object from a query string, use the Parse(String, String) method:
StandardQueryParser queryParserHelper = new StandardQueryParser();
Query query = queryParserHelper.Parse("a AND b", "defaultField");
To change any configuration before parsing the query string do, for example:
// the query config handler returned by StandardQueryParser is a
// StandardQueryConfigHandler
queryParserHelper.QueryConfigHandler.Analyzer = new WhitespaceAnalyzer();
The syntax for query strings is as follows (copied from the old QueryParser javadoc):
A Query is a series of clauses. A clause may be prefixed by:
-
a plus (
+
) or a minus (-
) sign, indicating that the clause is required or prohibited respectively; or - a term followed by a colon, indicating the field to be searched. This enables one to construct queries which search multiple fields.
- a term, indicating all the documents that contain this term; or
-
a nested query, enclosed in parentheses. Note that this may be used with
a
+
/-
prefix to require any of a set of terms.
Query ::= ( Clause )*
Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )
Examples of appropriately formatted queries can be found in the query syntax documentation.
The text parser used by this helper is a StandardSyntaxParser.
The query node processor used by this helper is a StandardQueryNodeProcessorPipeline.
The builder used by this helper is a StandardQueryTreeBuilder.
Interfaces
ICommonQueryParserConfiguration
Configuration options common across queryparser implementations.