Interface FacetExtractor
- All Known Implementing Classes:
DistinctValuesFacetExtractor,PredefinedBucketsFacetExtractor,PropertyFacetExtractor
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
invalid reference
#equals(Object)invalid reference
#hashCode()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 Summary
Modifier and TypeMethodDescriptiongetFacet()Called after the result set was scanned (andhandleNode(Node)was called for each node in the result) to retrieve the finalFacetobject.voidhandleNode(Node node) Called for each node of the result set.
-
Method Details
-
handleNode
Called for each node of the result set.- Parameters:
node- node in the result- Throws:
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 (andhandleNode(Node)was called for each node in the result) to retrieve the finalFacetobject. Please note that this might be called withouthandleNode(Node)ever being called, if the result was empty.Implementations can use the simple
FacetImplimplementation of theFacetinterface.- Returns:
- an implementation of the
Facetinterface with all buckets found in the result ornullif nothing was found in the result
-