org.apache.lucene.facet.search
Class FacetResultNode

java.lang.Object
  extended by org.apache.lucene.facet.search.FacetResultNode
All Implemented Interfaces:
Comparable<FacetResultNode>
Direct Known Subclasses:
RangeFacetResultNode

public class FacetResultNode
extends Object
implements Comparable<FacetResultNode>

Result of faceted search for a certain taxonomy node. This class serves as a bin of different attributes of the result node, such as its ordinal as well as label. You are not expected to modify those values.

This class implements Comparable for easy comparisons of result nodes, e.g. when sorting or computing top-K nodes.

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

Field Summary
static List<FacetResultNode> EMPTY_SUB_RESULTS
           
 CategoryPath label
          The label of this result.
 int ordinal
          The category ordinal of this node.
 List<FacetResultNode> subResults
          The sub-results of this result.
 double value
          The value of this result.
 
Constructor Summary
FacetResultNode(int ordinal, double value)
           
 
Method Summary
 int compareTo(FacetResultNode o)
           
 String toString()
           
 String toString(String prefix)
          Returns a String representation of this facet result node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_SUB_RESULTS

public static final List<FacetResultNode> EMPTY_SUB_RESULTS

ordinal

public int ordinal
The category ordinal of this node.


label

public CategoryPath label
The label of this result. May be null if not computed, in which case use TaxonomyReader.getPath(int) to label it.

NOTE: by default, all nodes are labeled. Only when FacetRequest.getNumLabel() < FacetRequest.numResults there will be unlabeled nodes.


value

public double value
The value of this result. Its actual type depends on the FacetRequest used (e.g. in case of CountFacetRequest it is int).


subResults

public List<FacetResultNode> subResults
The sub-results of this result. If FacetRequest.getResultMode() is FacetRequest.ResultMode.PER_NODE_IN_TREE, every sub result denotes an immediate child of this node. Otherwise, it is a descendant of any level.

NOTE: this member should not be null. To denote that a result does not have sub results, set it to EMPTY_SUB_RESULTS (or don't modify it).

Constructor Detail

FacetResultNode

public FacetResultNode(int ordinal,
                       double value)
Method Detail

compareTo

public int compareTo(FacetResultNode o)
Specified by:
compareTo in interface Comparable<FacetResultNode>

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(String prefix)
Returns a String representation of this facet result node.



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