Package org.apache.lucene.demo.facet
Class DistanceFacetsExample
java.lang.Object
org.apache.lucene.demo.facet.DistanceFacetsExample
- All Implemented Interfaces:
Closeable
,AutoCloseable
Shows simple usage of dynamic range faceting, using the expressions module to calculate distance.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
Mean radius of the Earth in KMstatic final double
The "home" latitude.static final double
The "home" longitude. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
drillDown
(DoubleRange range) User drills down on the specified range.static Query
getBoundingBoxQuery
(double originLat, double originLng, double maxDistanceKM) Given a latitude and longitude (in degrees) and the maximum great circle (surface of the earth) distance, returns a simple Filter bounding box to "fast match" candidates.void
index()
Build the example index.static void
Runs the search and drill-down examples and prints the results.search()
User runs a query and counts facets.
-
Field Details
-
ORIGIN_LATITUDE
The "home" latitude.- See Also:
-
ORIGIN_LONGITUDE
The "home" longitude.- See Also:
-
EARTH_RADIUS_KM
Mean radius of the Earth in KMNOTE: this is approximate, because the earth is a bit wider at the equator than the poles. See http://en.wikipedia.org/wiki/Earth_radius
- See Also:
-
-
Constructor Details
-
DistanceFacetsExample
public DistanceFacetsExample()Empty constructor
-
-
Method Details
-
index
Build the example index.- Throws:
IOException
-
getBoundingBoxQuery
Given a latitude and longitude (in degrees) and the maximum great circle (surface of the earth) distance, returns a simple Filter bounding box to "fast match" candidates. -
search
User runs a query and counts facets.- Throws:
IOException
-
drillDown
User drills down on the specified range.- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
main
Runs the search and drill-down examples and prints the results.- Throws:
Exception
-