## org.apache.lucene.facet.search
Class FacetResult

    java.lang.Object
      org.apache.lucene.facet.search.FacetResult

    public class FacetResult

extends Object

Result of faceted search.

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

Constructor Summary
`FacetResult(FacetRequest facetRequest, FacetResultNode rootNode, int numValidDescendants)`

Method Summary
`FacetRequest` `getFacetRequest()` Request for which this result was obtained.
`FacetResultNode` `getFacetResultNode()` Facet result node matching the root of the `facet request`.
`int` `getNumValidDescendants()` Number of descendants of `root facet result node`, up till the requested depth.
`static List<FacetResult>` `mergeHierarchies(List<FacetResult> results, TaxonomyReader taxoReader, Map<String,FacetArrays> dimArrays)` A utility for merging multiple `FacetResult` of the same (hierarchical) dimension into a single `FacetResult`, to reconstruct the hierarchy.
`String` `toString()`
`String` `toString(String prefix)` String representation of this facet result.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FacetResult

    public FacetResult(FacetRequest facetRequest,
                       FacetResultNode rootNode,
                       int numValidDescendants)

Method Detail

### mergeHierarchies

    public static List<FacetResult> mergeHierarchies(List<FacetResult> results,
                                                     TaxonomyReader taxoReader,
                                                     Map<String,FacetArrays> dimArrays)
                                              throws IOException

  A utility for merging multiple `FacetResult` of the same (hierarchical) dimension into a single `FacetResult`, to reconstruct the hierarchy. The results are merged according to the following rules:
  - If two results share the same dimension (first component in their `CategoryPath`), they are merged.
  - If a result is missing ancestors in the other results, e.g. A/B/C but no corresponding A or A/B, these nodes are 'filled' with their label, ordinal and value (obtained from the respective `FacetArrays`).
  - If a result does not share a dimension with other results, it is returned as is.

  NOTE: the returned results are not guaranteed to be in the same order of the input ones.

  Parameters:
    `results` - the results to merge
    `taxoReader` - the `TaxonomyReader` to use when creating missing ancestor nodes
    `dimArrays` - a mapping from a dimension to the respective `FacetArrays` from which to pull the nodes values
  Throws:
    `IOException`

### getFacetResultNode

    public final FacetResultNode getFacetResultNode()

  Facet result node matching the root of the `facet request`.

  See Also:
    `getFacetRequest()`, `FacetRequest.categoryPath`

### getNumValidDescendants

    public final int getNumValidDescendants()

  Number of descendants of `root facet result node`, up till the requested depth.

### getFacetRequest

    public final FacetRequest getFacetRequest()

  Request for which this result was obtained.

### toString

    public String toString(String prefix)

  String representation of this facet result. Use with caution: might return a very long string.

  Parameters:
    `prefix` - prefix for each result line
  See Also:
    `toString()`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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