|
22 | 22 | * operations. In the new query parser structure, the parsing was divided in 3 steps: parsing
|
23 | 23 | * (syntax), processing (semantic) and building.
|
24 | 24 | *
|
25 |
| - * <p>The classes contained in the package org.apache.lucene.queryParser.standard are used to |
26 |
| - * reproduce the same behavior as the old query parser. |
| 25 | + * <p>Flexible query parser is a modular, extensible framework for implementing Lucene query |
| 26 | + * parsers. In the flexible query parser model, query parsing takes three steps: syntax parsing, |
| 27 | + * processing (query semantics) and building (conversion to a Lucene {@link |
| 28 | + * org.apache.lucene.search.Query}). |
27 | 29 | *
|
28 |
| - * <p>Check {@link org.apache.lucene.queryparser.flexible.standard.StandardQueryParser} to quick |
29 |
| - * start using the Lucene query parser. |
| 30 | + * <p>The flexible query parser module provides not just the framework but also the {@linkplain |
| 31 | + * org.apache.lucene.queryparser.flexible.standard.StandardQueryParser} - the default implementation |
| 32 | + * of a fully fledged query parser that supports most of the classic query parser's syntax but also |
| 33 | + * adds support for interval functions, min-should-match operator on Boolean groups and many hooks |
| 34 | + * for customization of how the parser behaves at runtime. |
| 35 | + * |
| 36 | + * <p>The flexible query parser is divided in two packages: |
| 37 | + * |
| 38 | + * <ul> |
| 39 | + * <li>{@link org.apache.lucene.queryparser.flexible.core}: contains the query parser API classes, |
| 40 | + * which should be extended by custom query parser implementations. |
| 41 | + * <li>{@link org.apache.lucene.queryparser.flexible.standard}: contains an example Lucene query |
| 42 | + * parser implementation built on top of the flexible query parser API. |
| 43 | + * </ul> |
| 44 | + * |
| 45 | + * <h2>Features</h2> |
| 46 | + * |
| 47 | + * <ol> |
| 48 | + * <li>full support for Boolean expressions, including groups |
| 49 | + * <li>{@linkplain org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser syntax parsers} |
| 50 | + * - support for arbitrary syntax parsers, that can be converted into {@link |
| 51 | + * org.apache.lucene.queryparser.flexible.core.nodes.QueryNode} trees. |
| 52 | + * <li>{@linkplain org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessor query |
| 53 | + * node processors} - optimize, validate, rewrite the {@link |
| 54 | + * org.apache.lucene.queryparser.flexible.core.nodes.QueryNode} trees |
| 55 | + * <li>{@linkplain |
| 56 | + * org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorPipeline processor |
| 57 | + * pipelines} - select your favorite query processors and build a pipeline to implement the |
| 58 | + * features you need. |
| 59 | + * <li>{@linkplain org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler query |
| 60 | + * configuration handlers} |
| 61 | + * <li>{@linkplain org.apache.lucene.queryparser.flexible.core.builders.QueryBuilder query |
| 62 | + * builders} - convert {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode} |
| 63 | + * trees into Lucene {@link org.apache.lucene.search.Query} instances. |
| 64 | + * </ol> |
| 65 | + * |
| 66 | + * <h2>Design</h2> |
| 67 | + * |
| 68 | + * <p>The flexible query parser was designed to have a very generic architecture, so that it can be |
| 69 | + * easily used for different products with varying query syntax needs. |
| 70 | + * |
| 71 | + * <p>The query parser has three layers and its core is what we call the {@linkplain |
| 72 | + * org.apache.lucene.queryparser.flexible.core.nodes.QueryNode query node tree}. It is a tree of |
| 73 | + * objects that represent the syntax of the original query, for example, for 'a AND b' the tree |
| 74 | + * could look like this: |
| 75 | + * |
| 76 | + * <pre> |
| 77 | + * AND |
| 78 | + * / \ |
| 79 | + * A B |
| 80 | + * </pre> |
| 81 | + * |
| 82 | + * <p>The three flexible query parser layers are: |
| 83 | + * |
| 84 | + * <dl> |
| 85 | + * <dt>{@link org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser} |
| 86 | + * <dd>This layer is the text parsing layer which simply transforms the query text string into a |
| 87 | + * {@link org.apache.lucene.queryparser.flexible.core.nodes.QueryNode} tree. Every text parser |
| 88 | + * must implement the interface {@link |
| 89 | + * org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser}. The default |
| 90 | + * implementation is {@link |
| 91 | + * org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser}. |
| 92 | + * <dt>{@link org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessor} |
| 93 | + * <dd>The query node processor does most of the work: it contains a chain of {@linkplain |
| 94 | + * org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessor query node |
| 95 | + * processors}. Each processor can walk the tree and modify nodes or even the tree's |
| 96 | + * structure. This allows for query optimization before the node tree is converted to an |
| 97 | + * actual query. |
| 98 | + * <dt>{@link org.apache.lucene.queryparser.flexible.core.builders.QueryBuilder} |
| 99 | + * <dd>The third layer is a configurable map of builders, which map {@linkplain |
| 100 | + * org.apache.lucene.queryparser.flexible.core.nodes.QueryNode query nodes} to their adapters |
| 101 | + * that convert each node into a {@link org.apache.lucene.search.Query}. |
| 102 | + * </dl> |
30 | 103 | */
|
31 | 104 | package org.apache.lucene.queryparser.flexible.standard;
|
0 commit comments