org.hibernate.search.spatial.impl
Class DistanceFilter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by org.hibernate.search.spatial.impl.DistanceFilter
All Implemented Interfaces:
Serializable

public final class DistanceFilter
extends org.apache.lucene.search.Filter

Lucene Filter for filtering documents which have been indexed with Hibernate Search spatial Field bridge Use double lat,long field in the index from a Coordinates field declaration

Author:
Nicolas Helleringer
See Also:
SpatialFieldBridgeByQuadTree, SpatialFieldBridgeByRange, Coordinates, Serialized Form

Constructor Summary
DistanceFilter(org.apache.lucene.search.Filter previousFilter, Point center, double radius, String coordinatesField)
          Construct a Distance Filter to match document distant at most of radius from center Point
DistanceFilter(org.apache.lucene.search.Filter previousFilter, Point center, double radius, String latitudeField, String longitudeField)
          Construct a Distance Filter to match document distant at most of radius from center Point
 
Method Summary
 org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader)
          Returns Doc Ids by retrieving their lat,long and checking if within distance(radius) of the center of the search
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DistanceFilter

public DistanceFilter(org.apache.lucene.search.Filter previousFilter,
                      Point center,
                      double radius,
                      String coordinatesField)
Construct a Distance Filter to match document distant at most of radius from center Point

Parameters:
previousFilter - previous Filter in the chain. As Distance is costly by retrieving the lat and long field it is better to use it last
center - center of the search perimeter
radius - radius of the search perimeter
coordinatesField - name of the field implementing Coordinates
See Also:
Coordinates

DistanceFilter

public DistanceFilter(org.apache.lucene.search.Filter previousFilter,
                      Point center,
                      double radius,
                      String latitudeField,
                      String longitudeField)
Construct a Distance Filter to match document distant at most of radius from center Point

Parameters:
previousFilter - previous Filter in the chain. As Distance is costly by retrieving the lat and long field it is better to use it last
center - center of the search perimeter
radius - radius of the search perimeter
latitudeField - name of the field hosting latitude
longitudeField - name of the field hosting longitude
See Also:
Coordinates
Method Detail

getDocIdSet

public org.apache.lucene.search.DocIdSet getDocIdSet(org.apache.lucene.index.IndexReader reader)
                                              throws IOException
Returns Doc Ids by retrieving their lat,long and checking if within distance(radius) of the center of the search

Specified by:
getDocIdSet in class org.apache.lucene.search.Filter
Parameters:
reader - reader to the index
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2013 Red Hat Middleware, LLC. All Rights Reserved