C# (CSharp) Lucene.Net.QueryParsers.Flexible.Spans Namespace

Classes

Name Description
SpanOrQueryNodeBuilder This builder creates SpanOrQuerys from a BooleanQueryNode. It assumes that the BooleanQueryNode instance has at least one child.
SpanTermQueryNodeBuilder This builder creates SpanTermQuerys from a FieldQueryNode object.
SpansQueryConfigHandler This query config handler only adds the IUniqueFieldAttribute to it. It does not return any configuration for a field in specific.
SpansValidatorQueryNodeProcessor Validates every query node in a query node tree. This processor will pass fine if the query nodes are only BooleanQueryNodes, OrQueryNodes or FieldQueryNodes, otherwise an exception will be thrown. If they are AndQueryNode or an instance of anything else that implements FieldQueryNode the exception will also be thrown.
TestSpanQueryParser This test case demonstrates how the new query parser can be used. It tests queries likes "term", "field:term" "term1 term2" "term1 OR term2", which are all already supported by the current syntax parser ( StandardSyntaxParser). The goals is to create a new query parser that supports only the pair "field:term" or a list of pairs separated or not by an OR operator, and from this query generate SpanQuery objects instead of the regular Search.Query objects. Basically, every pair will be converted to a SpanTermQuery object and if there are more than one pair they will be grouped by an OrQueryNode. Another functionality that will be added is the ability to convert every field defined in the query to an unique specific field. The query generation is divided in three different steps: parsing (syntax), processing (semantic) and building. The parsing phase, as already mentioned will be performed by the current query parser: StandardSyntaxParser. The processing phase will be performed by a processor pipeline which is compound by 2 processors: SpansValidatorQueryNodeProcessor and UniqueFieldQueryNodeProcessor. SpansValidatorQueryNodeProcessor: as it's going to use the current query parser to parse the syntax, it will support more features than we want, this processor basically validates the query node tree generated by the parser and just let got through the elements we want, all the other elements as wildcards, range queries, etc...if found, an exception is thrown. UniqueFieldQueryNodeProcessor: this processor will take care of reading what is the "unique field" from the configuration and convert every field defined in every pair to this "unique field". For that, a SpansQueryConfigHandler is used, which has the IUniqueFieldAttribute defined in it. The building phase is performed by the SpansQueryTreeBuilder, which basically contains a map that defines which builder will be used to generate SpanQuery objects from IQueryNode objects.
TestSpanQueryParserSimpleSample This test case demonstrates how the new query parser can be used. It tests queries likes "term", "field:term" "term1 term2" "term1 OR term2", which are all already supported by the current syntax parser ( StandardSyntaxParser). The goals is to create a new query parser that supports only the pair "field:term" or a list of pairs separated or not by an OR operator, and from this query generate SpanQuery objects instead of the regular Search.Query objects. Basically, every pair will be converted to a SpanTermQuery object and if there are more than one pair they will be grouped by an OrQueryNode. Another functionality that will be added is the ability to convert every field defined in the query to an unique specific field. The query generation is divided in three different steps: parsing (syntax), processing (semantic) and building. The parsing phase, as already mentioned will be performed by the current query parser: StandardSyntaxParser. The processing phase will be performed by a processor pipeline which is compound by 2 processors: SpansValidatorQueryNodeProcessor and UniqueFieldQueryNodeProcessor. SpansValidatorQueryNodeProcessor: as it's going to use the current query parser to parse the syntax, it will support more features than we want, this processor basically validates the query node tree generated by the parser and just let got through the elements we want, all the other elements as wildcards, range queries, etc...if found, an exception is thrown. UniqueFieldQueryNodeProcessor: this processor will take care of reading what is the "unique field" from the configuration and convert every field defined in every pair to this "unique field". For that, a SpansQueryConfigHandler is used, which has the IUniqueFieldAttribute defined in it. The building phase is performed by the SpansQueryTreeBuilder, which basically contains a map that defines which builder will be used to generate SpanQuery objects from IQueryNode objects.
UniqueFieldAttributeImpl This attribute is used by the UniqueFieldQueryNodeProcessor processor. It holds a value that defines which is the unique field name that should be set in every Core.Nodes.IFieldableNode.
UniqueFieldQueryNodeProcessor This processor changes every field name of each IFieldableNode query node contained in the query tree to the field name defined in the IUniqueFieldAttribute. So, the IUniqueFieldAttribute must be defined in the QueryConfigHandler object set in this processor, otherwise it throws an exception.