com.browseengine.bobo.facets.impl
Class DefaultFacetCountCollector

java.lang.Object
  extended by com.browseengine.bobo.facets.impl.DefaultFacetCountCollector
All Implemented Interfaces:
FacetAccessible, FacetCountCollector
Direct Known Subclasses:
GroupByFacetCountCollector, MultiValueFacetHandler.MultiValueFacetCountCollector, SimpleFacetHandler.SimpleFacetCountCollector

public abstract class DefaultFacetCountCollector
extends Object
implements FacetCountCollector


Field Summary
protected  BigSegmentedArray _array
           
 int[] _count
           
 int _countlength
           
protected  FacetDataCache _dataCache
           
protected  FacetSpec _ospec
           
protected  BrowseSelection _sel
           
protected  LinkedList<int[]> intarraylist
           
protected static MemoryManager<int[]> intarraymgr
           
 
Fields inherited from interface com.browseengine.bobo.facets.FacetCountCollector
EMPTY_FACET_LIST
 
Constructor Summary
DefaultFacetCountCollector(String name, FacetDataCache dataCache, int docBase, BrowseSelection sel, FacetSpec ospec)
           
 
Method Summary
 void close()
          Responsible for release resources used.
abstract  void collect(int docid)
          Collect a hit.
abstract  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.
 FacetDataCache getFacetDataCache()
           
 List<BrowseFacet> getFacets()
          Gets gathered top facets
static List<BrowseFacet> getFacets(FacetSpec ospec, int[] count, int countlength, TermValueList<?> valList)
           
 String getName()
          Gets the name of the facet
 FacetIterator iterator()
          This function returns an Iterator to visit the facets in value order
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ospec

protected final FacetSpec _ospec

_count

public int[] _count

_countlength

public int _countlength

_dataCache

protected FacetDataCache _dataCache

_sel

protected final BrowseSelection _sel

_array

protected final BigSegmentedArray _array

intarraylist

protected final LinkedList<int[]> intarraylist

intarraymgr

protected static MemoryManager<int[]> intarraymgr
Constructor Detail

DefaultFacetCountCollector

public DefaultFacetCountCollector(String name,
                                  FacetDataCache dataCache,
                                  int docBase,
                                  BrowseSelection sel,
                                  FacetSpec ospec)
Method Detail

getName

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

Specified by:
getName in interface FacetCountCollector
Returns:
facet name

collect

public abstract 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 - doc

collectAll

public abstract 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

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 - Facet value
Returns:
a facet with count filled in

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:
integer array of count values representing distribution of the facet values.

getFacetDataCache

public FacetDataCache getFacetDataCache()

getFacets

public static List<BrowseFacet> getFacets(FacetSpec ospec,
                                          int[] count,
                                          int countlength,
                                          TermValueList<?> valList)

getFacets

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

Specified by:
getFacets in interface FacetAccessible
Returns:
list of facets

close

public void close()
Description copied from interface: FacetAccessible
Responsible for release resources used. If the implementing class does not use a lot of resources, it does not have to do anything.

Specified by:
close in interface FacetAccessible

iterator

public FacetIterator iterator()
This function returns an Iterator to visit the facets in value order

Specified by:
iterator in interface FacetAccessible
Returns:
The Iterator to iterate over the facets in value order


Copyright © 2011. All Rights Reserved.