com.browseengine.bobo.facets.impl
Class GeoFacetCountCollector

java.lang.Object
  extended by com.browseengine.bobo.facets.impl.GeoFacetCountCollector
All Implemented Interfaces:
FacetAccessible, FacetCountCollector

public class GeoFacetCountCollector
extends Object
implements FacetCountCollector

Author:
nnarkhed

Nested Class Summary
static class GeoFacetCountCollector.GeoRange
           
 
Field Summary
 
Fields inherited from interface com.browseengine.bobo.facets.FacetCountCollector
EMPTY_FACET_LIST
 
Constructor Summary
protected GeoFacetCountCollector(String name, GeoFacetHandler.GeoFacetData dataCache, int docBase, FacetSpec fspec, List<String> predefinedRanges, boolean miles)
           
 
Method Summary
 void close()
           
 void collect(int docid)
          Collect a hit.
 void collectAll()
          Collects all hits.
 int[] getCountDistribution()
          Returns an integer array representing the distribution function of a given facet.
 BrowseFacet getFacet(String value)
          Gets the facet given a value.
 List<BrowseFacet> getFacets()
          Gets gathered top facets
 String getName()
          Gets the name of the facet
 FacetIterator iterator()
          Returns an iterator to visit all the facets
static GeoFacetCountCollector.GeoRange parse(String range)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeoFacetCountCollector

protected GeoFacetCountCollector(String name,
                                 GeoFacetHandler.GeoFacetData dataCache,
                                 int docBase,
                                 FacetSpec fspec,
                                 List<String> predefinedRanges,
                                 boolean miles)
Parameters:
name - name of the Geo Facet
dataCache - The data cache for the Geo Facet
docBase - the base doc id
spec - the facet spec for this facet
predefinedRanges - List of ranges, where each range looks like
miles - variable to specify if the geo distance calculations are in miles. False indicates distance calculation is in kilometers
Method Detail

collect

public void collect(int docid)
Description copied from interface: FacetCountCollector
Collect a hit. This is called for every hit, thus the implementation needs to be super-optimized.

Specified by:
collect in interface FacetCountCollector
Parameters:
docid - The docid for which the facet counts are to be calculated

collectAll

public void collectAll()
Description copied from interface: FacetCountCollector
Collects all hits. This is called once per request by the facet engine in certain scenarios.

Specified by:
collectAll in interface FacetCountCollector

getCountDistribution

public int[] getCountDistribution()
Description copied from interface: FacetCountCollector
Returns an integer array representing the distribution function of a given facet.

Specified by:
getCountDistribution in interface FacetCountCollector
Returns:
Count distribution for all the user specified range values

getName

public String getName()
Description copied from interface: FacetCountCollector
Gets the name of the facet

Specified by:
getName in interface FacetCountCollector
Returns:
facet name

getFacet

public BrowseFacet getFacet(String value)
Description copied from interface: FacetAccessible
Gets the facet given a value. This is a way for random accessing into the facet data structure.

Specified by:
getFacet in interface FacetAccessible
Parameters:
value - This value should be one of the user-specified ranges for this Facet Count Collector. Else an IllegalArgumentException will be raised
Returns:
The BrowseFacet corresponding to the range value

getFacets

public List<BrowseFacet> getFacets()
Description copied from interface: FacetAccessible
Gets gathered top facets

Specified by:
getFacets in interface FacetAccessible
Returns:
A list containing BrowseFacet objects for each of the user-specified ranges

parse

public static GeoFacetCountCollector.GeoRange parse(String range)
Parameters:
range - Value should be of the format - lat , lon : radius
Returns:
GeoRange object containing the lat, lon and radius value

close

public void close()
Specified by:
close in interface FacetAccessible

iterator

public FacetIterator iterator()
Description copied from interface: FacetAccessible
Returns an iterator to visit all the facets

Specified by:
iterator in interface FacetAccessible
Returns:
Returns a FacetIterator to iterate over all the facets


Copyright © 2011. All Rights Reserved.