# Package org.apache.lucene.queryparser.flexible.core

package org.apache.lucene.queryparser.flexible.core
Core classes of the flexible query parser framework.

## Flexible Query Parser

This package contains the necessary classes to implement a query parser.

A query parser is divided in at least 2 phases, text parsing and query building, and one optional phase called query processing.

### First Phase: Text Parsing

The text parsing phase is performed by a text parser, which implements `SyntaxParser` interface. A text parser is responsible to get a query string and convert it to a `QueryNode` tree, which is an object structure that represents the elements defined in the query string.

### Second (optional) Phase: Query Processing

The query processing phase is performed by a query processor, which implements `QueryNodeProcessor`. A query processor is responsible to perform any processing on a `QueryNode` tree. This phase is optional and is used only if an extra processing, validation, query expansion, etc needs to be performed in a `QueryNode` tree. The `QueryNode` tree can be either be generated by a text parser or programmatically created.

### Third Phase: Query Building

The query building phase is performed by a query builder, which implements `QueryBuilder`. A query builder is responsible to convert a `QueryNode` tree into an arbitrary object, which is usually used to be executed against a search index.

Related Packages
Package
Description
org.apache.lucene.queryparser.flexible.core.builders
Necessary classes to implement query builders.
org.apache.lucene.queryparser.flexible.core.config
Base classes used to configure the query processing.
org.apache.lucene.queryparser.flexible.core.messages
Messages usually used by query parser implementations.
org.apache.lucene.queryparser.flexible.core.nodes
Query nodes commonly used by query parser implementations.
org.apache.lucene.queryparser.flexible.core.parser
Necessary interfaces to implement text parsers.
org.apache.lucene.queryparser.flexible.core.processors
Interfaces and implementations used by query node processors
org.apache.lucene.queryparser.flexible.core.util
Utility classes to used with the Query Parser.
Class
Description
QueryNodeError
Error class with NLS support
QueryNodeException
This exception should be thrown if something wrong happens when dealing with `QueryNode`s.
QueryNodeParseException
This should be thrown when an exception happens during the query parsing from string to the query node tree.
QueryParserHelper
This class is a helper for the query parser framework, it does all the three query parser phrases at once: text parsing, query processing and query building.