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
Implements
Inherited Members
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
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 wrappedquery , 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 NotSupportedException on rewriting this query!
|
Fields
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
m_query
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
Declaration
protected readonly Q m_query
Field Value
Type | Description |
---|---|
Q |
Properties
Field
Returns the name of the field matched by this query.
Note that this may returnnull
if the query matches no terms.
Declaration
public override string Field { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
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 |
WrappedQuery
Returns the wrapped query
Declaration
public virtual Query WrappedQuery { get; }
Property Value
Type | Description |
---|---|
Query |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetSpans(AtomicReaderContext, IBits, IDictionary<Term, TermContext>)
Expert: Returns the matches for this query in an index. Used internally to search for spans.
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
Rewrite(IndexReader)
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
Declaration
public override Query Rewrite(IndexReader reader)
Parameters
Type | Name | Description |
---|---|---|
IndexReader | reader |
Returns
Type | Description |
---|---|
Query |
Overrides
ToString(string)
Prints a query to a string, with field
assumed to be the
default field and omitted.
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
string | field |
Returns
Type | Description |
---|---|
string |