Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
Wrapper to allow SpanQuery objects participate in composite single-field SpanQueries by 'lying' about their search field. That is, the masked SpanQuery will function as normal, but SpanQuery.Field simply hands back the value supplied in this class's constructor. More...
Inherits Lucene.Net.Search.Spans.SpanQuery.
Public Member Functions | |
FieldMaskingSpanQuery (SpanQuery maskedQuery, System.String maskedField) | |
override Spans | GetSpans (IndexReader reader) |
Expert: Returns the matches for this query in an index. Used internally to search for spans. | |
override void | ExtractTerms (System.Collections.Generic.ISet< Term > terms) |
Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its rewritten form. | |
override Weight | CreateWeight (Searcher searcher) |
Expert: Constructs an appropriate Weight implementation for this query. | |
override Similarity | GetSimilarity (Searcher searcher) |
Expert: Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned. | |
override Query | Rewrite (IndexReader reader) |
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys. | |
override System.String | ToString (System.String field) |
Prints a query to a string, with field assumed to be the default field and omitted. The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
| |
override bool | Equals (System.Object o) |
override int | GetHashCode () |
Public Member Functions inherited from Lucene.Net.Search.Spans.SpanQuery | |
override Weight | CreateWeight (Searcher searcher) |
Expert: Constructs an appropriate Weight implementation for this query. | |
Public Member Functions inherited from Lucene.Net.Search.Query | |
override System.String | ToString () |
Prints a query to a string. | |
virtual Weight | Weight (Searcher searcher) |
Expert: Constructs and initializes a Weight for a top-level query. | |
virtual Query | Combine (Query[] queries) |
Expert: called when re-writing queries under MultiSearcher. | |
virtual System.Object | Clone () |
Returns a clone of this query. | |
override int | GetHashCode () |
override bool | Equals (System.Object obj) |
Properties | |
override string | Field [get] |
virtual SpanQuery | MaskedQuery [get] |
Properties inherited from Lucene.Net.Search.Spans.SpanQuery | |
abstract string | Field [get] |
Returns the name of the field matched by this query. | |
Properties inherited from Lucene.Net.Search.Query | |
virtual float | Boost [get, set] |
Gets or sets the boost for this query clause to b . Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b . The boost is 1.0 by default. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Lucene.Net.Search.Query | |
static Query | MergeBooleanQueries (params BooleanQuery[] queries) |
Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery. | |
Wrapper to allow SpanQuery objects participate in composite single-field SpanQueries by 'lying' about their search field. That is, the masked SpanQuery will function as normal, but SpanQuery.Field simply hands back the value supplied in this class's constructor.
This can be used to support Queries like SpanNearQuery or SpanOrQuery across different fields, which is not ordinarily permitted.
This can be useful for denormalized relational data: for example, when indexing a document with conceptually many 'children':
teacherid: 1 studentfirstname: james studentsurname: jones
teacherid: 2 studenfirstname: james studentsurname: smith studentfirstname: sally studentsurname: jones
a SpanNearQuery with a slop of 0 can be applied across two SpanTermQuery objects as follows: SpanQuery q1 = new SpanTermQuery(new Term("studentfirstname", "james")); SpanQuery q2 = new SpanTermQuery(new Term("studentsurname", "jones")); SpanQuery q2m new FieldMaskingSpanQuery(q2, "studentfirstname"); Query q = new SpanNearQuery(new SpanQuery[]{q1, q2m}, -1, false);
to search for 'studentfirstname:james studentsurname:jones' and find teacherid 1 without matching teacherid 2 (which has a 'james' in position 0 and 'jones' in position 1).
Note: as Field returns the masked field, scoring will be done using the norms of the field name supplied. This may lead to unexpected scoring behaviour.
Definition at line 72 of file FieldMaskingSpanQuery.cs.
Lucene.Net.Search.Spans.FieldMaskingSpanQuery.FieldMaskingSpanQuery | ( | SpanQuery | maskedQuery, |
System.String | maskedField | ||
) |
Definition at line 77 of file FieldMaskingSpanQuery.cs.
|
virtual |
Expert: Constructs an appropriate Weight implementation for this query.
Only implemented by primitive queries, which re-write to themselves.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 106 of file FieldMaskingSpanQuery.cs.
override bool Lucene.Net.Search.Spans.FieldMaskingSpanQuery.Equals | ( | System.Object | o | ) |
Definition at line 149 of file FieldMaskingSpanQuery.cs.
|
virtual |
Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its rewritten form.
<throws> UnsupportedOperationException if this query is not yet rewritten </throws>
Reimplemented from Lucene.Net.Search.Query.
Definition at line 101 of file FieldMaskingSpanQuery.cs.
override int Lucene.Net.Search.Spans.FieldMaskingSpanQuery.GetHashCode | ( | ) |
Definition at line 157 of file FieldMaskingSpanQuery.cs.
|
virtual |
Expert: Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 111 of file FieldMaskingSpanQuery.cs.
|
virtual |
Expert: Returns the matches for this query in an index. Used internally to search for spans.
Implements Lucene.Net.Search.Spans.SpanQuery.
Definition at line 96 of file FieldMaskingSpanQuery.cs.
|
virtual |
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
Reimplemented from Lucene.Net.Search.Query.
Definition at line 116 of file FieldMaskingSpanQuery.cs.
|
virtual |
Prints a query to a string, with field
assumed to be the default field and omitted. The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:
Implements Lucene.Net.Search.Query.
Definition at line 137 of file FieldMaskingSpanQuery.cs.
|
get |
Definition at line 84 of file FieldMaskingSpanQuery.cs.
|
get |
Definition at line 89 of file FieldMaskingSpanQuery.cs.