Class TreeMaker

All Implemented Interfaces:
LogEnabled, Component

public class TreeMaker extends AbstractLogEnabled implements Component
Creates a AbstractTreeNode from a JSON object, typically got from client-side AdvancedSearchFormPanel.
  • Field Details

    • ROLE

      public static final String ROLE
      The component role.
  • Constructor Details

  • Method Details

    • create

      Creates a AbstractTreeNode from JSON values
      Type Parameters:
      T - the type of the values of the leaves of the tree to create
      Parameters:
      values - the JSON values
      leafValueMaker - The function to create the value of a TreeLeaf
      Returns:
      the created AbstractTreeNode from JSON values
    • toQuery

      public <V extends WrappedValue> Query toQuery(V value, String stringOperator, BiFunction<V,Query.Operator,Query> toQuery, String language, Map<String,Object> contextualParameters)
      Gets the query given the parameters.
      If the provided operator as string represents a real server-side Query.Operator, then it is just the provided BiFunction which is applied.
      Otherwise, the operator is a client-side one, and it will be transformed by modifying the value (by adding wildcards for instance), and deducting the server-side Query.Operator. Then, the BiFunction is applied with the transformed value and the deducted Query.Operator.
      Type Parameters:
      V - The type of WrappedValue
      Parameters:
      value - The value
      stringOperator - The operator as string
      toQuery - A function applied to a transformed value (not necessarily the one given by the method, as it can be transformed by adding wildcard chars, escaping...) and a real Query.Operator (deducted from the given client-side string operator)
      language - The language
      contextualParameters - The contextual parameters
      Returns:
      The result query
    • escapeQueryCharsForLikeQuery

      protected static String escapeQueryCharsForLikeQuery(String string, Map<String,Object> contextualParameters)
      Escape special Solr query characters of the user input, before building the query in order to append '*' character(s)
      Parameters:
      string - The string to escape.
      contextualParameters - the search contextual parameters.
      Returns:
      The escaped string.