Namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes
Query nodes commonly used by query parser implementations.
Query Nodes
The namespace Lucene.Net.QueryParsers.Flexible.Core.Nodes contains all the basic query nodes. The interface that represents a query node is IQueryNode.
IQueryNodes are used by the text parser to create a syntax tree. These nodes are designed to be used by UI or other text parsers. The default Lucene text parser is StandardSyntaxParser, it implements Lucene's standard syntax.
IQueryNode interface should be implemented by all query nodes, the class QueryNode implements IQueryNode and is extended by all current query node implementations.
A query node tree can be printed to the a stream, and it generates a pseudo XML representation with all the nodes.
A query node tree can also generate a query string that can be parsed back by the original text parser, at this point only the standard lucene syntax is supported.
Grouping nodes:
- AndQueryNode - used for AND operator
- AnyQueryNode - used for ANY operator
- OrQueryNode - used for OR operator
- BooleanQueryNode - used when no operator is specified
- ModifierQueryNode - used for modifier operator
- GroupQueryNode - used for parenthesis
- BoostQueryNode - used for boost operator
- SlopQueryNode - phrase slop
- FuzzyQueryNode - fuzzy node
- TermRangeQueryNode - used for parametric field:
[low_value TO high_value]
- ProximityQueryNode - used for proximity search
- NumericRangeQueryNode - used for numeric range search
TokenizedPhraseQueryNode - used by tokenizers/lemmatizers/analyzers for phrases/autophrases
Leaf Nodes:
FieldQueryNode - field/value node
- NumericQueryNode - used for numeric search
- PathQueryNode - IQueryNode object used with path-like queries
- OpaqueQueryNode - Used as for part of the query that can be parsed by other parsers. schema/value
- PrefixWildcardQueryNode - non-phrase wildcard query
- QuotedFieldQUeryNode - regular phrase node
WildcardQueryNode - non-phrase wildcard query
Utility Nodes:
DeletedQueryNode - used by processors on optimizations
- MatchAllDocsQueryNode - used by processors on optimizations
- MatchNoDocsQueryNode - used by processors on optimizations
- NoTokenFoundQueryNode - used by tokenizers/lemmatizers/analyzers
Classes
AndQueryNode
A AndQueryNode represents an AND boolean operation performed on a list of nodes.
AnyQueryNode
A AnyQueryNode represents an ANY operator performed on a list of nodes.
BooleanQueryNode
A BooleanQueryNode represents a list of elements which do not have an explicit boolean operator defined between them. It can be used to express a boolean query that intends to use the default boolean operator.
BoostQueryNode
A BoostQueryNode boosts the QueryNode tree which is under this node. So, it must only and always have one child.
The boost value may vary from 0.0 to 1.0.
DeletedQueryNode
A DeletedQueryNode represents a node that was deleted from the query node tree. It can be removed from the tree using the RemoveDeletedQueryNodesProcessor processor.
FieldQueryNode
A FieldQueryNode represents a element that contains field/text tuple
FuzzyQueryNode
A FuzzyQueryNode represents a element that contains field/text/similarity tuple
GroupQueryNode
A GroupQueryNode represents a location where the original user typed real parenthesis on the query string. This class is useful for queries like: a) a AND b OR c b) ( a AND b) OR c
Parenthesis might be used to define the boolean operation precedence.
MatchAllDocsQueryNode
A MatchAllDocsQueryNode indicates that a query node tree or subtree will match all documents if executed in the index.
MatchNoDocsQueryNode
A MatchNoDocsQueryNode indicates that a query node tree or subtree will not match any documents if executed in the index.
ModifierExtensions
ModifierQueryNode
A ModifierQueryNode indicates the modifier value (+,-,?,NONE) for each term on the query string. For example "+t1 -t2 t3" will have a tree of:
<BooleanQueryNode> <ModifierQueryNode modifier="MOD_REQ"> <t1/> </ModifierQueryNode> <ModifierQueryNode modifier="MOD_NOT"> <t2/> </ModifierQueryNode> <t3/> </BooleanQueryNode>
NoTokenFoundQueryNode
A NoTokenFoundQueryNode is used if a term is convert into no tokens by the tokenizer/lemmatizer/analyzer (null).
OpaqueQueryNode
A OpaqueQueryNode is used for specify values that are not supposed to be parsed by the parser. For example: and XPATH query in the middle of a query string a b @xpath:'/bookstore/book[1]/title' c d
OrQueryNode
A OrQueryNode represents an OR boolean operation performed on a list of nodes.
PathQueryNode
A PathQueryNode is used to store queries like /company/USA/California /product/shoes/brown. QueryText are objects that contain the text, begin position and end position in the query.
Example how the text parser creates these objects:
IList<PathQueryNode.QueryText> values = new List<PathQueryNode.QueryText>();
values.Add(new PathQueryNode.QueryText("company", 1, 7));
values.Add(new PathQueryNode.QueryText("USA", 9, 12));
values.Add(new PathQueryNode.QueryText("California", 14, 23));
QueryNode q = new PathQueryNode(values);
PathQueryNode.QueryText
Term text with a beginning and end position
PhraseSlopQueryNode
Query node for Lucene.Net.Search.PhraseQuery's slop factor.
ProximityQueryNode
A ProximityQueryNode represents a query where the terms should meet specific distance conditions. (a b c) WITHIN [SENTENCE|PARAGRAPH|NUMBER] [INORDER] ("a" "b" "c") WITHIN [SENTENCE|PARAGRAPH|NUMBER] [INORDER]
TODO: Add this to the future standard Lucene parser/processor/builder
ProximityQueryNode_TypeExtensions
ProximityType
utility class containing the distance condition and number
QueryNode
A QueryNode is the default implementation of the interface IQueryNode
QuotedFieldQueryNode
A QuotedFieldQueryNode represents phrase query. Example: "life is great"
SlopQueryNode
A SlopQueryNode represents phrase query with a slop.
From Lucene FAQ: Is there a way to use a proximity operator (like near or within) with Lucene? There is a variable called slop that allows you to perform NEAR/WITHIN-like queries. By default, slop is set to 0 so that only exact phrases will match. When using TextParser you can use this syntax to specify the slop: "doug cutting"~2 will find documents that contain "doug cutting" as well as ones that contain "cutting doug".
TokenizedPhraseQueryNode
A TokenizedPhraseQueryNode represents a node created by a code that tokenizes/lemmatizes/analyzes.
Interfaces
IFieldableNode
A query node implements IFieldableNode interface to indicate that its children and itself are associated to a specific field.
If it has any children which also implements this interface, it must ensure the children are associated to the same field.
IFieldValuePairQueryNode<T>
This interface should be implemented by IQueryNode that holds a field and an arbitrary value.
IQueryNode
A IQueryNode is a interface implemented by all nodes on a IQueryNode tree.
IRangeQueryNode
LUCENENET specific interface for identifying a RangeQueryNode without specifying its generic closing type
IRangeQueryNode<T>
This interface should be implemented by an IQueryNode that represents some kind of range query.
ITextableQueryNode
Interface for a node that has text as a J2N.Text.ICharSequence
IValueQueryNode<T>
This interface should be implemented by IQueryNode that holds an arbitrary value.
Enums
Modifier
Modifier type: such as required (REQ), prohibited (NOT)
ProximityQueryNode.Type
Distance condition: PARAGRAPH, SENTENCE, or NUMBER