Class SpanNearQuery
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Inherited Members
Namespace: Lucene.Net.Search.Spans
Assembly: Lucene.Net.dll
Syntax
public class SpanNearQuery : SpanQuery
Constructors
SpanNearQuery(SpanQuery[], int, bool)
Construct a SpanNearQuery. Matches spans matching a span from each
clause, with up to slop
total unmatched positions between
them. * When inOrder
is true
, the spans from each clause
must be * ordered as in clauses
.
Declaration
public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder)
Parameters
Type | Name | Description |
---|---|---|
SpanQuery[] | clauses | The clauses to find near each other |
int | slop | The slop value |
bool | inOrder |
|
SpanNearQuery(SpanQuery[], int, bool, bool)
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Declaration
public SpanNearQuery(SpanQuery[] clauses, int slop, bool inOrder, bool collectPayloads)
Parameters
Type | Name | Description |
---|---|---|
SpanQuery[] | clauses | |
int | slop | |
bool | inOrder | |
bool | collectPayloads |
Fields
m_clauses
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Declaration
protected readonly IList<SpanQuery> m_clauses
Field Value
Type | Description |
---|---|
IList<SpanQuery> |
m_field
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Declaration
protected string m_field
Field Value
Type | Description |
---|---|
string |
m_inOrder
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Declaration
protected bool m_inOrder
Field Value
Type | Description |
---|---|
bool |
m_slop
Matches spans which are near one another. One can specify slop, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
Declaration
protected int m_slop
Field Value
Type | Description |
---|---|
int |
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
IsInOrder
Return true
if matches are required to be in-order.
Declaration
public virtual bool IsInOrder { get; }
Property Value
Type | Description |
---|---|
bool |
Slop
Return the maximum number of intervening unmatched positions permitted.
Declaration
public virtual int Slop { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Clone()
Returns a clone of this query.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
object |
Overrides
Equals(object)
Returns true iff
o
is equal to this.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o |
Returns
Type | Description |
---|---|
bool |
Overrides
ExtractTerms(ISet<Term>)
Expert: adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten (Rewrite(IndexReader)) form.
Declaration
public override void ExtractTerms(ISet<Term> terms)
Parameters
Type | Name | Description |
---|---|---|
ISet<Term> | terms |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If this query is not yet rewritten |
GetClauses()
Return the clauses whose spans are matched.
Declaration
public virtual SpanQuery[] GetClauses()
Returns
Type | Description |
---|---|
SpanQuery[] |
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 |