Class QueryFieldConfig

java.lang.Object
org.codelibs.fess.query.QueryFieldConfig

public class QueryFieldConfig extends Object
Configuration class for query field mappings in the Fess search engine. This class manages field configurations for various query operations including response fields, search fields, facet fields, sort fields, and highlighting. It initializes field mappings from the FessConfig and provides methods to query field properties and capabilities.
  • Field Details

    • SCORE_FIELD

      public static final String SCORE_FIELD
      Field name for document score in search results
      See Also:
    • DOC_SCORE_FIELD

      public static final String DOC_SCORE_FIELD
      Field name for OpenSearch document score
      See Also:
    • SITE_FIELD

      public static final String SITE_FIELD
      Field name for site information in search results
      See Also:
    • INURL_FIELD

      public static final String INURL_FIELD
      Field name for URL-based search queries
      See Also:
    • SCORE_SORT_VALUE

      protected static final String SCORE_SORT_VALUE
      Sort value for score-based sorting
      See Also:
    • responseFields

      protected String[] responseFields
      Array of fields to be included in standard search response
    • scrollResponseFields

      protected String[] scrollResponseFields
      Array of fields to be included in scroll search response
    • cacheResponseFields

      protected String[] cacheResponseFields
      Array of fields to be included in cache search response
    • highlightedFields

      protected String[] highlightedFields
      Array of fields that can be highlighted in search results
    • searchFields

      protected String[] searchFields
      Array of fields that can be searched against
    • searchFieldSet

      protected Set<String> searchFieldSet
      Set of fields that can be searched against for O(1) lookup
    • facetFields

      protected String[] facetFields
      Array of fields that can be used for faceted search
    • facetFieldSet

      protected Set<String> facetFieldSet
      Set of fields that can be used for faceted search for O(1) lookup
    • sortFields

      protected String[] sortFields
      Array of fields that can be used for sorting search results
    • sortFieldSet

      protected Set<String> sortFieldSet
      Set of fields that can be used for sorting for O(1) lookup
    • apiResponseFieldSet

      protected Set<String> apiResponseFieldSet
      Set of fields that are allowed in API responses
    • notAnalyzedFieldSet

      protected Set<String> notAnalyzedFieldSet
      Set of fields that are not analyzed during indexing
    • additionalDefaultList

      protected List<org.codelibs.core.misc.Pair<String,Float>> additionalDefaultList
      List of additional default fields with their boost values
  • Constructor Details

    • QueryFieldConfig

      public QueryFieldConfig()
      Default constructor.
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the query field configuration by loading field mappings from FessConfig. This method is called after dependency injection is complete. It sets up response fields, search fields, facet fields, sort fields, and other field configurations based on the application configuration.
    • setNotAnalyzedFields

      public void setNotAnalyzedFields(String[] fields)
      Sets the fields that should not be analyzed during indexing.
      Parameters:
      fields - array of field names that should not be analyzed
    • isSortField

      protected boolean isSortField(String field)
      Checks if the specified field can be used for sorting. Uses O(1) Set lookup for improved performance.
      Parameters:
      field - the field name to check
      Returns:
      true if the field can be used for sorting, false otherwise
    • isFacetField

      public boolean isFacetField(String field)
      Checks if the specified field can be used for faceted search. Uses O(1) Set lookup for improved performance.
      Parameters:
      field - the field name to check
      Returns:
      true if the field can be used for faceted search, false otherwise
    • isFacetSortValue

      public boolean isFacetSortValue(String sort)
      Checks if the specified sort value is valid for facet sorting.
      Parameters:
      sort - the sort value to check
      Returns:
      true if the sort value is valid for facets ("count" or "index"), false otherwise
    • setApiResponseFields

      public void setApiResponseFields(String[] fields)
      Sets the fields that are allowed in API responses.
      Parameters:
      fields - array of field names that are allowed in API responses
    • isApiResponseField

      public boolean isApiResponseField(String field)
      Checks if the specified field is allowed in API responses.
      Parameters:
      field - the field name to check
      Returns:
      true if the field is allowed in API responses, false otherwise
    • getResponseFields

      public String[] getResponseFields()
      Gets the fields that are included in standard search responses.
      Returns:
      array of field names for standard search responses
    • setResponseFields

      public void setResponseFields(String[] responseFields)
      Sets the fields that are included in standard search responses.
      Parameters:
      responseFields - array of field names for standard search responses
    • getScrollResponseFields

      public String[] getScrollResponseFields()
      Gets the fields that are included in scroll search responses.
      Returns:
      array of field names for scroll search responses
    • setScrollResponseFields

      public void setScrollResponseFields(String[] scrollResponseFields)
      Sets the fields that are included in scroll search responses.
      Parameters:
      scrollResponseFields - array of field names for scroll search responses
    • getCacheResponseFields

      public String[] getCacheResponseFields()
      Gets the fields that are included in cache search responses.
      Returns:
      array of field names for cache search responses
    • setCacheResponseFields

      public void setCacheResponseFields(String[] cacheResponseFields)
      Sets the fields that are included in cache search responses.
      Parameters:
      cacheResponseFields - array of field names for cache search responses
    • getHighlightedFields

      public String[] getHighlightedFields()
      Gets the fields that can be highlighted in search results.
      Returns:
      array of field names that can be highlighted
    • setHighlightedFields

      public void setHighlightedFields(String[] highlightedFields)
      Sets the fields that can be highlighted in search results.
      Parameters:
      highlightedFields - array of field names that can be highlighted
    • highlightedFields

      public void highlightedFields(Consumer<Stream<String>> stream)
      Processes the highlighted fields using the provided stream consumer.
      Parameters:
      stream - consumer that processes the stream of highlighted field names
    • getSearchFields

      public String[] getSearchFields()
      Gets the fields that can be searched against.
      Returns:
      array of field names that can be searched
    • setSearchFields

      public void setSearchFields(String[] supportedFields)
      Sets the fields that can be searched against. Also updates the searchFieldSet for O(1) lookup performance.
      Parameters:
      supportedFields - array of field names that can be searched
    • getFacetFields

      public String[] getFacetFields()
      Gets the fields that can be used for faceted search.
      Returns:
      array of field names that can be used for faceted search
    • setFacetFields

      public void setFacetFields(String[] facetFields)
      Sets the fields that can be used for faceted search. Also updates the facetFieldSet for O(1) lookup performance.
      Parameters:
      facetFields - array of field names that can be used for faceted search
    • getSortFields

      public String[] getSortFields()
      Gets the fields that can be used for sorting search results.
      Returns:
      array of field names that can be used for sorting
    • setSortFields

      public void setSortFields(String[] sortFields)
      Sets the fields that can be used for sorting search results. Also updates the sortFieldSet for O(1) lookup performance.
      Parameters:
      sortFields - array of field names that can be used for sorting