Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
Lucene.Net.Search.MultiPhraseQuery Class Reference

MultiPhraseQuery is a generalized version of PhraseQuery, with an added method Add(Term[]). To use this class, to search for the phrase "Microsoft app*" first use add(Term) on the term "Microsoft", then find all terms that have "app" as prefix using IndexReader.terms(Term), and use MultiPhraseQuery.add(Term[] terms) to add them to the query. More...

Inherits Lucene.Net.Search.Query.

Public Member Functions

virtual void Add (Term term)
 Add a single term at the next position in the phrase.
 
virtual void Add (Term[] terms)
 Add multiple terms at the next position in the phrase. Any of the terms may match.
 
virtual void Add (Term[] terms, int position)
 Allows to specify the relative position of terms within the phrase.
 
virtual
System.Collections.Generic.IList
< Term[]> 
GetTermArrays ()
 Returns a List<Term[]> of the terms in the multiphrase. Do not modify the List or its contents.
 
virtual int[] GetPositions ()
 Returns the relative positions of terms in this phrase.
 
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 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 Weight CreateWeight (Searcher searcher)
 Expert: Constructs an appropriate Weight implementation for this query.
 
override System.String ToString (System.String f)
 Prints a user-readable version of this query.
 
override bool Equals (System.Object o)
 Returns true if o is equal to this.
 
override int GetHashCode ()
 Returns a hash code value for this object.
 
- 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 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.
 
virtual System.Object Clone ()
 Returns a clone of this query.
 
override int GetHashCode ()
 
override bool Equals (System.Object obj)
 

Static Public Member Functions

static bool TermEquals (System.Array array1, System.Array array2)
 
- 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.
 

Properties

virtual int Slop [get, set]
 Gets or sets the phrase slop for 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.
 

Detailed Description

MultiPhraseQuery is a generalized version of PhraseQuery, with an added method Add(Term[]). To use this class, to search for the phrase "Microsoft app*" first use add(Term) on the term "Microsoft", then find all terms that have "app" as prefix using IndexReader.terms(Term), and use MultiPhraseQuery.add(Term[] terms) to add them to the query.

<version> 1.0 </version>

Definition at line 40 of file MultiPhraseQuery.cs.

Member Function Documentation

virtual void Lucene.Net.Search.MultiPhraseQuery.Add ( Term  term)
virtual

Add a single term at the next position in the phrase.

See Also
PhraseQuery.Add(Term)

Definition at line 60 of file MultiPhraseQuery.cs.

virtual void Lucene.Net.Search.MultiPhraseQuery.Add ( Term[]  terms)
virtual

Add multiple terms at the next position in the phrase. Any of the terms may match.

See Also
PhraseQuery.Add(Term)

Definition at line 71 of file MultiPhraseQuery.cs.

virtual void Lucene.Net.Search.MultiPhraseQuery.Add ( Term[]  terms,
int  position 
)
virtual

Allows to specify the relative position of terms within the phrase.

See Also
PhraseQuery.Add(Term, int)
Parameters
terms
position

Definition at line 89 of file MultiPhraseQuery.cs.

override Weight Lucene.Net.Search.MultiPhraseQuery.CreateWeight ( Searcher  searcher)
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 309 of file MultiPhraseQuery.cs.

override bool Lucene.Net.Search.MultiPhraseQuery.Equals ( System.Object  o)

Returns true if o is equal to this.

Definition at line 370 of file MultiPhraseQuery.cs.

override void Lucene.Net.Search.MultiPhraseQuery.ExtractTerms ( System.Collections.Generic.ISet< Term terms)
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 125 of file MultiPhraseQuery.cs.

override int Lucene.Net.Search.MultiPhraseQuery.GetHashCode ( )

Returns a hash code value for this object.

Definition at line 413 of file MultiPhraseQuery.cs.

virtual int [] Lucene.Net.Search.MultiPhraseQuery.GetPositions ( )
virtual

Returns the relative positions of terms in this phrase.

Definition at line 116 of file MultiPhraseQuery.cs.

virtual System.Collections.Generic.IList<Term[]> Lucene.Net.Search.MultiPhraseQuery.GetTermArrays ( )
virtual

Returns a List<Term[]> of the terms in the multiphrase. Do not modify the List or its contents.

Definition at line 110 of file MultiPhraseQuery.cs.

override Query Lucene.Net.Search.MultiPhraseQuery.Rewrite ( IndexReader  reader)
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 289 of file MultiPhraseQuery.cs.

static bool Lucene.Net.Search.MultiPhraseQuery.TermEquals ( System.Array  array1,
System.Array  array2 
)
static

Definition at line 472 of file MultiPhraseQuery.cs.

override System.String Lucene.Net.Search.MultiPhraseQuery.ToString ( System.String  f)
virtual

Prints a user-readable version of this query.

Implements Lucene.Net.Search.Query.

Definition at line 315 of file MultiPhraseQuery.cs.

Property Documentation

virtual int Lucene.Net.Search.MultiPhraseQuery.Slop
getset

Gets or sets the phrase slop for this query.

See Also
PhraseQuery.Slop

Definition at line 52 of file MultiPhraseQuery.cs.


The documentation for this class was generated from the following file: