Index: lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java (revision 1364638) +++ lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java (revision ) @@ -30,7 +30,7 @@ import org.apache.lucene.spatial.prefix.tree.Node; import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree; import org.apache.lucene.spatial.query.SpatialArgs; -import org.apache.lucene.spatial.util.CachedDistanceValueSource; +import org.apache.lucene.spatial.util.ShapeFieldCacheDistanceValueSource; import java.util.Iterator; import java.util.List; @@ -144,7 +144,7 @@ } } Point point = args.getShape().getCenter(); - return new CachedDistanceValueSource(point, calc, p); + return new ShapeFieldCacheDistanceValueSource(point, calc, p); } public SpatialPrefixTree getGrid() { Index: lucene/spatial/src/java/org/apache/lucene/spatial/util/CachedDistanceValueSource.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/util/CachedDistanceValueSource.java (revision 1364638) +++ lucene/spatial/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheDistanceValueSource.java (revision ) @@ -28,17 +28,20 @@ import java.util.Map; /** - * An implementation of the Lucene ValueSource model to support spatial relevance ranking. + * An implementation of the Lucene ValueSource that returns the spatial distance + * between an input point and a document's points in + * {@link ShapeFieldCacheProvider}. The shortest distance is returned if a + * document has more than one point. * * @lucene.internal */ -public class CachedDistanceValueSource extends ValueSource { +public class ShapeFieldCacheDistanceValueSource extends ValueSource { private final ShapeFieldCacheProvider provider; private final DistanceCalculator calculator; private final Point from; - public CachedDistanceValueSource(Point from, DistanceCalculator calc, ShapeFieldCacheProvider provider) { + public ShapeFieldCacheDistanceValueSource(Point from, DistanceCalculator calc, ShapeFieldCacheProvider provider) { this.from = from; this.provider = provider; this.calculator = calc; @@ -46,7 +49,7 @@ @Override public String description() { - return "DistanceValueSource("+calculator+")"; + return getClass().getSimpleName()+"("+calculator+")"; } @Override @@ -85,7 +88,7 @@ if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - CachedDistanceValueSource that = (CachedDistanceValueSource) o; + ShapeFieldCacheDistanceValueSource that = (ShapeFieldCacheDistanceValueSource) o; if (calculator != null ? !calculator.equals(that.calculator) : that.calculator != null) return false; if (from != null ? !from.equals(that.from) : that.from != null) return false;