Package com.day.cq.search.facets
Interface FacetExtractor
-
- All Known Implementing Classes:
DistinctValuesFacetExtractor
,PredefinedBucketsFacetExtractor
,PropertyFacetExtractor
public interface FacetExtractor
FacetExtractor
extracts aFacet
from a result set from aQuery
. For each node in the result,handleNode(Node)
will be called and the implementation should keep track of the values or ratherBuckets
. After the result set was scanned,getFacet()
will be called to retrieve the finalFacet
.Performance Note: In order to minimize the number of
FacetExtractors
andFacets
, all implementations should properly implement the#equals(Object)
(and thus also#hashCode()
) methods so that the framework can remove duplicateFacetExtractors
before scanning the result nodes. The reason is that somePredicates
will createFacets
of the same type, since they follow the same definition, but have different user-chosen values to check against. As aFacet
tries to find all different values present in a search result, for the same type ofPredicateEvaluator
orFacet
, they will return the same set of values /Buckets
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Facet
getFacet()
Called after the result set was scanned (andhandleNode(Node)
was called for each node in the result) to retrieve the finalFacet
object.void
handleNode(Node node)
Called for each node of the result set.
-
-
-
Method Detail
-
handleNode
void handleNode(Node node) throws RepositoryException
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 finalFacet
object. Please note that this might be called withouthandleNode(Node)
ever being called, if the result was empty.Implementations can use the simple
FacetImpl
implementation of theFacet
interface.- Returns:
- an implementation of the
Facet
interface with all buckets found in the result ornull
if nothing was found in the result
-
-