Class FacetRequest

java.lang.Object
org.apache.solr.search.facet.FacetRequest
Direct Known Subclasses:
FacetField, FacetHeatmap, FacetQuery, FacetRange

public abstract class FacetRequest extends Object
A request to do facets/stats that might itself be composed of sub-FacetRequests. This is a cornerstone of the facet module.
See Also:
  • Field Details

  • Constructor Details

    • FacetRequest

      public FacetRequest()
  • Method Details

    • parse

      public static FacetRequest parse(SolrQueryRequest req, Map<String,Object> params)
      Factory method to parse a facet request tree. The outer keys are arbitrary labels and their values are facet request specifications. Will throw a SolrException if it fails to parse.
      Parameters:
      req - the overall request
      params - a typed parameter structure (unlike SolrParams which are all string values).
    • parseOneFacetReq

      public static FacetRequest parseOneFacetReq(SolrQueryRequest req, Map<String,Object> params)
      Factory method to parse out a rooted facet request tree that would normally go one level below a label. The params must contain a "type". This is intended to be useful externally, such as by SimpleFacets.
      Parameters:
      req - the overall request
      params - a typed parameter structure (unlike SolrParams which are all string values).
    • getFacetStats

      public Map<String,AggValueSource> getFacetStats()
    • getSubFacets

      public Map<String,FacetRequest> getSubFacets()
    • getRefineMethod

      public FacetRequest.RefineMethod getRefineMethod()
      Returns null if unset
    • doRefine

      public boolean doRefine()
    • returnsPartial

      public boolean returnsPartial()
      Returns true if this facet can return just some of the facet buckets that match all the criteria. This is normally true only for facets with a limit.
    • canProduceFromEmpty

      public boolean canProduceFromEmpty()
      Returns true if this facet, or any sub-facets can produce results from an empty domain.
    • addStat

      public void addStat(String key, AggValueSource stat)
    • addSubFacet

      public void addSubFacet(String key, FacetRequest facetRequest)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • process

      public final Object process(SolrQueryRequest req, DocSet domain) throws IOException
      Process this facet request against the given domain of docs. Note: this is currently used externally by SimpleFacets.
      Throws:
      IOException
    • createFacetProcessor

      public abstract FacetProcessor<? extends FacetRequest> createFacetProcessor(FacetContext fcontext)
    • createFacetMerger

      public abstract FacetMerger createFacetMerger(Object prototype)
    • getFacetDescription

      public abstract Map<String,Object> getFacetDescription()