Class FacetInfo

java.lang.Object
org.codelibs.fess.entity.FacetInfo

public class FacetInfo extends Object
Entity class representing facet configuration information for search results. This class holds configuration settings for faceted search including field facets, query facets, and various parameters that control facet behavior.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Array of field names to create facets for
    Minimum document count required for a facet value to be included
    Value to use for documents that don't have the facet field
    Array of query strings to create query facets for
    Maximum number of facet values to return
    Sort order for facet values (e.g., "count.desc", "term.asc")
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for FacetInfo.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a query facet to the existing query array.
    org.opensearch.search.aggregations.BucketOrder
    Converts the sort string into a BucketOrder object for OpenSearch aggregations.
    void
    Initializes the facet configuration from Fess configuration properties.
    Returns a string representation of this FacetInfo object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • field

      public String[] field
      Array of field names to create facets for
    • query

      public String[] query
      Array of query strings to create query facets for
    • size

      public Integer size
      Maximum number of facet values to return
    • minDocCount

      public Long minDocCount
      Minimum document count required for a facet value to be included
    • sort

      public String sort
      Sort order for facet values (e.g., "count.desc", "term.asc")
    • missing

      public String missing
      Value to use for documents that don't have the facet field
  • Constructor Details

    • FacetInfo

      public FacetInfo()
      Default constructor for FacetInfo.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the facet configuration from Fess configuration properties. This method is called after dependency injection to load default facet settings.
    • getBucketOrder

      public org.opensearch.search.aggregations.BucketOrder getBucketOrder()
      Converts the sort string into a BucketOrder object for OpenSearch aggregations. Parses sort configuration like "count.desc" or "term.asc" into appropriate bucket ordering.
      Returns:
      the BucketOrder instance representing the sort configuration
    • addQuery

      public void addQuery(String s)
      Adds a query facet to the existing query array. If no queries exist, creates a new array with the provided query.
      Parameters:
      s - the query string to add as a facet
    • toString

      public String toString()
      Returns a string representation of this FacetInfo object. Includes all field values in the format useful for debugging.
      Overrides:
      toString in class Object
      Returns:
      string representation of this FacetInfo instance