20 using Lucene.Net.Index;
21 using Lucene.Net.Search;
22 using Lucene.Net.Search.Function;
24 namespace Lucene.Net.Spatial.Util
52 public override Query Rewrite(Index.IndexReader reader)
57 public override void ExtractTerms(System.Collections.Generic.ISet<
Term> terms)
71 enclosingInstance = q;
72 this.searcher = searcher;
76 internal float GetQueryNorm()
83 get {
return enclosingInstance; }
86 public override float Value
88 get {
return queryWeight; }
91 public override float GetSumOfSquaredWeights()
93 queryWeight = enclosingInstance.
Boost;
94 return queryWeight * queryWeight;
97 public override void Normalize(
float norm)
99 this.queryNorm = norm;
100 queryWeight *= this.queryNorm;
105 return new AllScorer(enclosingInstance.GetSimilarity(searcher), reader,
this);
119 readonly
float qWeight;
122 readonly
bool hasDeletions;
128 this.qWeight = w.
Value;
129 this.reader = reader;
130 this.maxDoc = reader.
MaxDoc;
135 public override int DocID()
144 public override int NextDoc()
151 return doc = NO_MORE_DOCS;
153 if (hasDeletions && reader.IsDeleted(doc))
continue;
158 public override int Advance(
int target)
165 public override float Score()
167 float score = qWeight * vals.FloatVal(doc);
172 return score >
float.NegativeInfinity ? score : -
float.MaxValue;
177 float sc = qWeight * vals.FloatVal(doc);
180 (
true, sc,
"FunctionQuery(" + ((
FunctionQuery)weight.Query).func +
"), product of:");
194 public override string ToString(
string field)
197 return (boost != 1.0 ?
"(" :
"") + func.
ToString()
198 + (boost == 1.0 ?
"" :
")^" + boost);
201 public override bool Equals(
object o)
205 if (other == null)
return false;
207 return this.Boost == other.
Boost && this.func.Equals(other.func);
210 public override int GetHashCode()
212 return (
int) (func.GetHashCode() * 31 + BitConverter.DoubleToInt64Bits(Boost));