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
    System.Object
    QueryParserHelper<TQuery>
    StandardQueryParser
    Namespace: Lucene.Net.QueryParsers.Flexible.Core
    Assembly: Lucene.Net.QueryParser.dll
    Syntax
    public class QueryParserHelper<TQuery> : object
    Type Parameters
    Name Description
    TQuery

    Constructors

    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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>
    | Improve this Doc View Source

    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)
    | Improve this Doc View Source

    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)
    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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
    System.String query

    the query string

    System.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

    | Improve this Doc View Source

    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>
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)