18 using Lucene.Net.Index;
19 using Lucene.Net.Search;
20 using Lucene.Net.Search.Function;
21 using Lucene.Net.Spatial.Util;
22 using Spatial4n.Core.Shapes;
23 using Spatial4n.Core.Shapes.Impl;
25 namespace Lucene.Net.Spatial.BBox
34 this.strategy = strategy;
35 this.similarity = similarity;
38 private class BBoxSimilarityValueSourceDocValues :
DocValues
41 private readonly Rectangle rect;
42 private readonly
double[] minX;
43 private readonly
double[] minY;
44 private readonly
double[] maxX;
45 private readonly
double[] maxY;
47 private readonly
IBits validMinX, validMaxX;
51 _enclosingInstance = enclosingInstance;
52 rect = _enclosingInstance.strategy.GetSpatialContext().MakeRectangle(0, 0, 0, 0);
63 public override float FloatVal(
int doc)
66 if (validMinX.Get(doc) && validMaxX.Get(doc))
70 minY[doc], maxY[doc]);
71 return (
float) _enclosingInstance.similarity.Score(rect, null);
75 return (
float) _enclosingInstance.similarity.Score(null, null);
82 if (validMinX.Get(doc) && validMaxX.Get(doc))
86 minY[doc], maxY[doc]);
88 _enclosingInstance.similarity.Score(rect, exp);
94 public override string ToString(
int doc)
96 return _enclosingInstance.Description() +
"=" + FloatVal(doc);
102 return new BBoxSimilarityValueSourceDocValues(reader,
this);
105 public override string Description()
107 return "BBoxSimilarityValueSource(" + similarity +
")";
110 public override bool Equals(
object o)
113 if (other == null)
return false;
114 return similarity.
Equals(other.similarity);
117 public override int GetHashCode()