Show / Hide Table of Contents

    Class SpanMultiTermQueryWrapper<Q>

    Wraps any MultiTermQuery as a SpanQuery, so it can be nested within other SpanQuery classes.

    The query is rewritten by default to a SpanOrQuery containing the expanded terms, but this can be customized.

    Example:

    WildcardQuery wildcard = new WildcardQuery(new Term("field", "bro?n"));
    SpanQuery spanWildcard = new SpanMultiTermQueryWrapper<WildcardQuery>(wildcard);
    // do something with spanWildcard, such as use it in a SpanFirstQuery
    Inheritance
    System.Object
    Query
    SpanQuery
    SpanMultiTermQueryWrapper<Q>
    Implements
    ISpanMultiTermQueryWrapper
    Inherited Members
    SpanQuery.CreateWeight(IndexSearcher)
    Query.Boost
    Query.ToString()
    Query.ExtractTerms(ISet<Term>)
    Query.Clone()
    Namespace: Lucene.Net.Search.Spans
    Assembly: Lucene.Net.dll
    Syntax
    public class SpanMultiTermQueryWrapper<Q> : SpanQuery, ISpanMultiTermQueryWrapper where Q : MultiTermQuery
    Type Parameters
    Name Description
    Q

    Constructors

    | Improve this Doc View Source

    SpanMultiTermQueryWrapper(Q)

    Create a new SpanMultiTermQueryWrapper<Q>.

    Declaration
    public SpanMultiTermQueryWrapper(Q query)
    Parameters
    Type Name Description
    Q query

    Query to wrap.

    NOTE: This will set MultiTermRewriteMethod on the wrapped query, changing its rewrite method to a suitable one for spans. Be sure to not change the rewrite method on the wrapped query afterwards! Doing so will throw on rewriting this query!

    Fields

    | Improve this Doc View Source

    m_query

    Declaration
    protected readonly Q m_query
    Field Value
    Type Description
    Q
    | Improve this Doc View Source

    SCORING_SPAN_QUERY_REWRITE

    A rewrite method that first translates each term into a SpanTermQuery in a SHOULD clause in a BooleanQuery, and keeps the scores as computed by the query.

    Declaration
    public static readonly SpanRewriteMethod SCORING_SPAN_QUERY_REWRITE
    Field Value
    Type Description
    SpanRewriteMethod
    See Also
    MultiTermRewriteMethod

    Properties

    | Improve this Doc View Source

    Field

    Declaration
    public override string Field { get; }
    Property Value
    Type Description
    System.String
    Overrides
    SpanQuery.Field
    | Improve this Doc View Source

    MultiTermRewriteMethod

    Expert: Gets or Sets the rewrite method. This only makes sense to be a span rewrite method.

    Declaration
    public SpanRewriteMethod MultiTermRewriteMethod { get; set; }
    Property Value
    Type Description
    SpanRewriteMethod
    | Improve this Doc View Source

    WrappedQuery

    Returns the wrapped query

    Declaration
    public virtual Query WrappedQuery { get; }
    Property Value
    Type Description
    Query

    Methods

    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    Query.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    Query.GetHashCode()
    | Improve this Doc View Source

    GetSpans(AtomicReaderContext, IBits, IDictionary<Term, TermContext>)

    Declaration
    public override Spans GetSpans(AtomicReaderContext context, IBits acceptDocs, IDictionary<Term, TermContext> termContexts)
    Parameters
    Type Name Description
    AtomicReaderContext context
    IBits acceptDocs
    IDictionary<Term, TermContext> termContexts
    Returns
    Type Description
    Spans
    Overrides
    SpanQuery.GetSpans(AtomicReaderContext, IBits, IDictionary<Term, TermContext>)
    | Improve this Doc View Source

    Rewrite(IndexReader)

    Declaration
    public override Query Rewrite(IndexReader reader)
    Parameters
    Type Name Description
    IndexReader reader
    Returns
    Type Description
    Query
    Overrides
    Query.Rewrite(IndexReader)
    | Improve this Doc View Source

    ToString(String)

    Declaration
    public override string ToString(string field)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    System.String
    Overrides
    Query.ToString(String)

    Implements

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