Show / Hide Table of Contents

    Class ExtendableQueryParser

    The ExtendableQueryParser enables arbitrary query parser extension based on a customizable field naming scheme. The lucene query syntax allows implicit and explicit field definitions as query prefix followed by a colon (':') character. The ExtendableQueryParser allows to encode extension keys into the field symbol associated with a registered instance of ParserExtension. A customizable separation character separates the extension key from the actual field symbol. The ExtendableQueryParser splits (SplitExtensionField(String, String)) the extension key from the field symbol and tries to resolve the associated ParserExtension. If the parser can't resolve the key or the field token does not contain a separation character, ExtendableQueryParser yields the same behavior as its super class QueryParser. Otherwise, if the key is associated with a ParserExtension instance, the parser builds an instance of ExtensionQuery to be processed by Parse(ExtensionQuery).If a extension field does not contain a field part the default field for the query will be used.

    To guarantee that an extension field is processed with its associated extension, the extension query part must escape any special characters like '*' or '['. If the extension query contains any whitespace characters, the extension query part must be enclosed in quotes. Example ('_' used as separation character):

      title_customExt:"Apache Lucene\?" OR content_customExt:prefix\*
    

    Search on the default field:

      _customExt:"Apache Lucene\?" OR _customExt:prefix\*
    

    The ExtendableQueryParser itself does not implement the logic how field and extension key are separated or ordered. All logic regarding the extension key and field symbol parsing is located in Extensions. Customized extension schemes should be implemented by sub-classing Extensions.

    For details about the default encoding scheme see Extensions.

    Inheritance
    System.Object
    QueryParserBase
    QueryParser
    ExtendableQueryParser
    Implements
    ICommonQueryParserConfiguration
    Inherited Members
    QueryParser.Conjunction()
    QueryParser.Modifiers()
    QueryParser.TopLevelQuery(String)
    QueryParser.Query(String)
    QueryParser.Clause(String)
    QueryParser.Term(String)
    QueryParser.TokenSource
    QueryParser.Token
    QueryParser.Jj_nt
    QueryParser.ReInit(ICharStream)
    QueryParser.ReInit(QueryParserTokenManager)
    QueryParser.GetNextToken()
    QueryParser.GetToken(Int32)
    QueryParser.GenerateParseException()
    QueryParser.Enable_tracing()
    QueryParser.Disable_tracing()
    QueryParserBase.CONJ_NONE
    QueryParserBase.CONJ_AND
    QueryParserBase.CONJ_OR
    QueryParserBase.MOD_NONE
    QueryParserBase.MOD_NOT
    QueryParserBase.MOD_REQ
    QueryParserBase.AND_OPERATOR
    QueryParserBase.OR_OPERATOR
    QueryParserBase.m_field
    QueryParserBase.Init(LuceneVersion, String, Analyzer)
    QueryParserBase.Parse(String)
    QueryParserBase.Field
    QueryParserBase.AutoGeneratePhraseQueries
    QueryParserBase.FuzzyMinSim
    QueryParserBase.FuzzyPrefixLength
    QueryParserBase.PhraseSlop
    QueryParserBase.AllowLeadingWildcard
    QueryParserBase.DefaultOperator
    QueryParserBase.LowercaseExpandedTerms
    QueryParserBase.MultiTermRewriteMethod
    QueryParserBase.Locale
    QueryParserBase.TimeZone
    QueryParserBase.SetDateResolution(DateTools.Resolution)
    QueryParserBase.SetDateResolution(String, DateTools.Resolution)
    QueryParserBase.GetDateResolution(String)
    QueryParserBase.AnalyzeRangeTerms
    QueryParserBase.AddClause(IList<BooleanClause>, Int32, Int32, Query)
    QueryParserBase.NewFieldQuery(Analyzer, String, String, Boolean)
    QueryParserBase.GetFieldQuery(String, String, Int32)
    QueryParserBase.GetRangeQuery(String, String, String, Boolean, Boolean)
    QueryParserBase.NewBooleanClause(Query, Occur)
    QueryParserBase.NewPrefixQuery(Term)
    QueryParserBase.NewRegexpQuery(Term)
    QueryParserBase.NewFuzzyQuery(Term, Single, Int32)
    QueryParserBase.AnalyzeMultitermTerm(String, String, Analyzer)
    QueryParserBase.NewRangeQuery(String, String, String, Boolean, Boolean)
    QueryParserBase.NewMatchAllDocsQuery()
    QueryParserBase.NewWildcardQuery(Term)
    QueryParserBase.GetBooleanQuery(IList<BooleanClause>)
    QueryParserBase.GetBooleanQuery(IList<BooleanClause>, Boolean)
    QueryParserBase.GetWildcardQuery(String, String)
    QueryParserBase.GetRegexpQuery(String, String)
    QueryParserBase.GetPrefixQuery(String, String)
    QueryParserBase.GetFuzzyQuery(String, String, Single)
    QueryParserBase.Escape(String)
    Namespace: Lucene.Net.QueryParsers.Ext
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class ExtendableQueryParser : QueryParser, ICommonQueryParserConfiguration

    Constructors

    | Improve this Doc View Source

    ExtendableQueryParser(LuceneVersion, String, Analyzer)

    Creates a new ExtendableQueryParser instance

    Declaration
    public ExtendableQueryParser(LuceneVersion matchVersion, string f, Analyzer a)
    Parameters
    Type Name Description
    LuceneVersion matchVersion

    the lucene version to use.

    System.String f

    the default query field

    Analyzer a

    the analyzer used to find terms in a query string

    | Improve this Doc View Source

    ExtendableQueryParser(LuceneVersion, String, Analyzer, Extensions)

    Creates a new ExtendableQueryParser instance

    Declaration
    public ExtendableQueryParser(LuceneVersion matchVersion, string f, Analyzer a, Extensions ext)
    Parameters
    Type Name Description
    LuceneVersion matchVersion

    the lucene version to use.

    System.String f

    the default query field

    Analyzer a

    the analyzer used to find terms in a query string

    Extensions ext

    the query parser extensions

    Properties

    | Improve this Doc View Source

    ExtensionFieldDelimiter

    Returns the extension field delimiter character.

    Declaration
    public virtual char ExtensionFieldDelimiter { get; }
    Property Value
    Type Description
    System.Char

    the extension field delimiter character.

    Methods

    | Improve this Doc View Source

    GetFieldQuery(String, String, Boolean)

    Declaration
    protected override Query GetFieldQuery(string field, string queryText, bool quoted)
    Parameters
    Type Name Description
    System.String field
    System.String queryText
    System.Boolean quoted
    Returns
    Type Description
    Query
    Overrides
    QueryParserBase.GetFieldQuery(String, String, Boolean)

    Implements

    ICommonQueryParserConfiguration

    See Also

    Extensions
    ParserExtension
    ExtensionQuery
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)