See: Description
Package | Description |
---|---|
org.apache.lucene.queryparser.classic |
A simple query parser implemented with JavaCC.
|
org.apache.lucene.queryparser.complexPhrase |
QueryParser which permits complex phrase query syntax eg "(john jon jonathan~) peters*"
|
org.apache.lucene.queryparser.ext |
Extendable QueryParser provides a simple and flexible extension mechanism by overloading query field names.
|
org.apache.lucene.queryparser.flexible.core |
Core classes of the flexible query parser framework.
|
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.
|
org.apache.lucene.queryparser.flexible.messages |
For Native Language Support (NLS), system of software internationalization.
|
org.apache.lucene.queryparser.flexible.precedence |
Precedence Query Parser Implementation
|
org.apache.lucene.queryparser.flexible.precedence.processors |
Processors used by Precedence Query Parser
|
org.apache.lucene.queryparser.flexible.standard |
Implementation of the Lucene classic query parser using the flexible query parser frameworks
|
org.apache.lucene.queryparser.flexible.standard.builders |
Standard Lucene Query Node Builders.
|
org.apache.lucene.queryparser.flexible.standard.config |
Standard Lucene Query Configuration.
|
org.apache.lucene.queryparser.flexible.standard.nodes |
Standard Lucene Query Nodes.
|
org.apache.lucene.queryparser.flexible.standard.parser |
Lucene Query Parser
|
org.apache.lucene.queryparser.flexible.standard.processors |
Lucene Query Node Processors.
|
org.apache.lucene.queryparser.simple |
A simple query parser for human-entered queries.
|
org.apache.lucene.queryparser.surround.parser |
This package contains the QueryParser.jj source file for the Surround parser.
|
org.apache.lucene.queryparser.surround.query |
This package contains SrndQuery and its subclasses.
|
org.apache.lucene.queryparser.xml |
Parser that produces Lucene Query objects from XML streams.
|
org.apache.lucene.queryparser.xml.builders |
XML Parser factories for different Lucene Query/Filters.
|
This module provides a number of queryparsers:
This project contains the new Lucene query parser implementation, which matches the syntax of the core QueryParser but offers a more modular architecture to enable customization.
It's currently divided in 2 main packages:
org.apache.lucene.queryparser.flexible.core
: it contains the query parser API classes, which should be extended by query parser implementations. org.apache.lucene.queryparser.flexible.standard
: it contains the current Lucene query parser implementation using the new query parser API.This new query parser was designed to have very generic architecture, so that it can be easily used for different products with varying query syntaxes. This code is much more flexible and extensible than the Lucene query parser in 2.4.X.
The new query parser goal is to separate syntax and semantics of a query. E.g. 'a AND b', '+a +b', 'AND(a,b)' could be different syntaxes for the same query. It distinguishes the semantics of the different query components, e.g. whether and how to tokenize/lemmatize/normalize the different terms or which Query objects to create for the terms. It allows to write a parser with a new syntax, while reusing the underlying semantics, as quickly as possible.
The query parser has three layers and its core is what we call the QueryNode tree. It is a tree that initially represents the syntax of the original query, e.g. for 'a AND b':
AND / \ A B
The three layers are:
QueryNode
tree. Every text parser
must implement the interface SyntaxParser
.
Lucene default implementations implements it using JavaCC.
QueryNode
types to its specific
builder that will transform the QueryNode into Lucene Query object.
Furthermore, the query parser uses flexible configuration objects. It also uses message classes that allow to attach resource bundles. This makes it possible to translate messages, which is an important feature of a query parser.
This design allows to develop different query syntaxes very quickly.
The classic Lucene query parser is located under
org.apache.lucene.queryparser.classic
.
To make it simpler to use the new query parser
the class StandardQueryParser
may be helpful,
specially for people that do not want to extend the Query Parser.
It uses the default Lucene query processors, text parser and builders, so
you don't need to worry about dealing with those.
StandardQueryParser
usage:
StandardQueryParser qpHelper = new StandardQueryParser(); StandardQueryConfigHandler config = qpHelper.getQueryConfigHandler(); config.setAllowLeadingWildcard(true); config.setAnalyzer(new WhitespaceAnalyzer()); Query query = qpHelper.parse("apache AND lucene", "defaultField");
A QueryParser that supports the Span family of queries as well as pre and infix notation.
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.