org.apache.lucene.facet.search
Class DepthOneFacetResultsHandler

java.lang.Object
  extended by org.apache.lucene.facet.search.FacetResultsHandler
      extended by org.apache.lucene.facet.search.DepthOneFacetResultsHandler
Direct Known Subclasses:
FloatFacetResultsHandler, IntFacetResultsHandler

public abstract class DepthOneFacetResultsHandler
extends FacetResultsHandler

A FacetResultsHandler which counts the top-K facets at depth 1 only and always labels all result categories. The results are always sorted by value, in descending order. Sub-classes are responsible to pull the values from the corresponding FacetArrays.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
 
Fields inherited from class org.apache.lucene.facet.search.FacetResultsHandler
facetArrays, facetRequest, taxonomyReader
 
Constructor Summary
DepthOneFacetResultsHandler(TaxonomyReader taxonomyReader, FacetRequest facetRequest, FacetArrays facetArrays)
           
 
Method Summary
protected abstract  void addSiblings(int ordinal, int[] siblings, ArrayList<FacetResultNode> nodes)
          Add the siblings of ordinal to the given list.
protected abstract  int addSiblings(int ordinal, int[] siblings, PriorityQueue<FacetResultNode> pq)
          Add the siblings of ordinal to the given PriorityQueue.
 FacetResult compute()
          Computes the FacetResult for the given FacetArrays.
protected abstract  double valueOf(int ordinal)
          Returnt the value of the requested ordinal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DepthOneFacetResultsHandler

public DepthOneFacetResultsHandler(TaxonomyReader taxonomyReader,
                                   FacetRequest facetRequest,
                                   FacetArrays facetArrays)
Method Detail

valueOf

protected abstract double valueOf(int ordinal)
Returnt the value of the requested ordinal. Called once for the result root.


addSiblings

protected abstract void addSiblings(int ordinal,
                                    int[] siblings,
                                    ArrayList<FacetResultNode> nodes)
                             throws IOException
Add the siblings of ordinal to the given list. This is called whenever the number of results is too high (> taxonomy size), instead of adding them to a PriorityQueue.

Throws:
IOException

addSiblings

protected abstract int addSiblings(int ordinal,
                                   int[] siblings,
                                   PriorityQueue<FacetResultNode> pq)
Add the siblings of ordinal to the given PriorityQueue. The given PriorityQueue is already filled with sentinel objects, so implementations are encouraged to use PriorityQueue.top() and PriorityQueue.updateTop() for best performance.


compute

public final FacetResult compute()
                          throws IOException
Description copied from class: FacetResultsHandler
Computes the FacetResult for the given FacetArrays.

Specified by:
compute in class FacetResultsHandler
Throws:
IOException


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.