Interface FacetExtractor

  • All Known Implementing Classes:
    DistinctValuesFacetExtractor, PredefinedBucketsFacetExtractor, PropertyFacetExtractor

    public interface FacetExtractor
    FacetExtractor extracts a Facet from a result set from a Query. For each node in the result, handleNode(Node) will be called and the implementation should keep track of the values or rather Buckets. After the result set was scanned, getFacet() will be called to retrieve the final Facet.

    Performance Note: In order to minimize the number of FacetExtractors and Facets, all implementations should properly implement the #equals(Object) (and thus also #hashCode()) methods so that the framework can remove duplicate FacetExtractors before scanning the result nodes. The reason is that some Predicates will create Facets of the same type, since they follow the same definition, but have different user-chosen values to check against. As a Facet tries to find all different values present in a search result, for the same type of PredicateEvaluator or Facet, they will return the same set of values / Buckets.

    • Method Detail

      • handleNode

        void handleNode​(Node node)
                 throws RepositoryException
        Called for each node of the result set.
        node - node in the result
        RepositoryException - if access to the node failed, ie. one of the methods on node threw an exception
      • getFacet

        Facet getFacet()
        Called after the result set was scanned (and handleNode(Node) was called for each node in the result) to retrieve the final Facet object. Please note that this might be called without handleNode(Node) ever being called, if the result was empty.

        Implementations can use the simple FacetImpl implementation of the Facet interface.

        an implementation of the Facet interface with all buckets found in the result or null if nothing was found in the result