Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class QueryParserHelper<TQuery>

    This class is a helper for the query parser framework, it does all the three query parser phrases at once: text parsing, query processing and query building.

    It contains methods that allows the user to change the implementation used on the three phases.

    Inheritance
    object
    QueryParserHelper<TQuery>
    StandardQueryParser
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.QueryParsers.Flexible.Core
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class QueryParserHelper<TQuery>
    Type Parameters
    Name Description
    TQuery

    Constructors

    QueryParserHelper(QueryConfigHandler, ISyntaxParser, IQueryNodeProcessor, IQueryBuilder<TQuery>)

    Creates a query parser helper object using the specified configuration, text parser, processor and builder.

    Declaration
    public QueryParserHelper(QueryConfigHandler queryConfigHandler, ISyntaxParser syntaxParser, IQueryNodeProcessor processor, IQueryBuilder<TQuery> builder)
    Parameters
    Type Name Description
    QueryConfigHandler queryConfigHandler

    the query configuration handler that will be initially set to this helper

    ISyntaxParser syntaxParser

    the text parser that will be initially set to this helper

    IQueryNodeProcessor processor

    the query processor that will be initially set to this helper

    IQueryBuilder<TQuery> builder

    the query builder that will be initially set to this helper

    See Also
    IQueryNodeProcessor
    ISyntaxParser
    IQueryBuilder<TQuery>
    QueryConfigHandler

    Properties

    QueryBuilder

    Returns the query builder used to build a object from the query node tree. The object produced by this builder is returned by Parse(string, string).

    Declaration
    public virtual IQueryBuilder<TQuery> QueryBuilder { get; }
    Property Value
    Type Description
    IQueryBuilder<TQuery>
    See Also
    SetQueryBuilder(IQueryBuilder<TQuery>)
    IQueryBuilder<TQuery>

    QueryConfigHandler

    Returns the query configuration handler, which is used during the query node tree processing. It can be null.

    Declaration
    public virtual QueryConfigHandler QueryConfigHandler { get; }
    Property Value
    Type Description
    QueryConfigHandler
    See Also
    QueryConfigHandler
    SetQueryConfigHandler(QueryConfigHandler)

    QueryNodeProcessor

    Gets the processor object used to process the query node tree, it returns null if no processor is used.

    Declaration
    public virtual IQueryNodeProcessor QueryNodeProcessor { get; }
    Property Value
    Type Description
    IQueryNodeProcessor
    See Also
    IQueryNodeProcessor
    SetQueryNodeProcessor(IQueryNodeProcessor)

    SyntaxParser

    Returns the text parser used to build a query node tree from a query string. The default text parser instance returned by this method is a ISyntaxParser.

    Declaration
    public virtual ISyntaxParser SyntaxParser { get; }
    Property Value
    Type Description
    ISyntaxParser
    See Also
    ISyntaxParser
    SetSyntaxParser(ISyntaxParser)

    Methods

    Parse(string, string)

    Parses a query string to an object, usually some query object.

    In this method the three phases are executed:

    1. the query string is parsed using the text parser returned by SyntaxParser, the result is a query node tree.
    2. the query node tree is processed by the processor returned by QueryNodeProcessor.
    3. a object is built from the query node tree using the builder returned by QueryBuilder.
    Declaration
    public virtual TQuery Parse(string query, string defaultField)
    Parameters
    Type Name Description
    string query

    the query string

    string defaultField

    the default field used by the text parser

    Returns
    Type Description
    TQuery

    the object built from the query

    Exceptions
    Type Condition
    QueryNodeException

    if something wrong happens along the three phases

    See Also
    IQueryNodeProcessor
    ISyntaxParser
    IQueryBuilder<TQuery>
    QueryConfigHandler

    SetQueryBuilder(IQueryBuilder<TQuery>)

    The query builder that will be used to build an object from the query node tree. It cannot be null.

    Declaration
    public virtual void SetQueryBuilder(IQueryBuilder<TQuery> queryBuilder)
    Parameters
    Type Name Description
    IQueryBuilder<TQuery> queryBuilder

    the query builder used to build something from the query node tree

    See Also
    QueryBuilder
    IQueryBuilder<TQuery>

    SetQueryConfigHandler(QueryConfigHandler)

    Sets the query configuration handler that will be used during query processing. It can be null. It's also set to the processor returned by QueryNodeProcessor.

    Declaration
    public virtual void SetQueryConfigHandler(QueryConfigHandler config)
    Parameters
    Type Name Description
    QueryConfigHandler config

    the query configuration handler used during query processing, it can be null

    See Also
    QueryConfigHandler
    QueryConfigHandler

    SetQueryNodeProcessor(IQueryNodeProcessor)

    Sets the processor that will be used to process the query node tree. If there is any QueryConfigHandler returned by QueryConfigHandler, it will be set on the processor. The argument can be null, which means that no processor will be used to process the query node tree.

    Declaration
    public virtual void SetQueryNodeProcessor(IQueryNodeProcessor processor)
    Parameters
    Type Name Description
    IQueryNodeProcessor processor

    the processor that will be used to process the query node tree, this argument can be null

    See Also
    QueryNodeProcessor
    IQueryNodeProcessor

    SetSyntaxParser(ISyntaxParser)

    Sets the text parser that will be used to parse the query string, it cannot be null.

    Declaration
    public virtual void SetSyntaxParser(ISyntaxParser syntaxParser)
    Parameters
    Type Name Description
    ISyntaxParser syntaxParser

    the text parser that will be used to parse the query string

    See Also
    SyntaxParser
    ISyntaxParser

    See Also

    IQueryNodeProcessor
    ISyntaxParser
    IQueryBuilder<TQuery>
    QueryConfigHandler
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.