public class TreeMaker extends AbstractLogEnabled implements Component
AbstractTreeNode
from a JSON object, typically got from client-side AdvancedSearchFormPanel.Modifier and Type | Class and Description |
---|---|
static class |
TreeMaker.ClientSideCriterionWrapper
A wrapper of a client-side criterion
|
Constructor and Description |
---|
TreeMaker() |
Modifier and Type | Method and Description |
---|---|
private <T> AbstractTreeNode<T> |
_create(Map<String,Object> values,
Function<TreeMaker.ClientSideCriterionWrapper,T> leafValueMaker) |
<T> AbstractTreeNode<T> |
create(Map<String,Object> values,
Function<TreeMaker.ClientSideCriterionWrapper,T> leafValueMaker)
Creates a
AbstractTreeNode from JSON values |
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)
|
Query |
toQuery(Object value,
String stringOperator,
BiFunction<Object,Query.Operator,Query> toQuery,
String language,
Map<String,Object> contextualParameters)
Gets the query given the parameters.
|
getLogger, setLogger
public TreeMaker()
public <T> AbstractTreeNode<T> create(Map<String,Object> values, Function<TreeMaker.ClientSideCriterionWrapper,T> leafValueMaker)
AbstractTreeNode
from JSON valuesT
- the type of the values of the leaves of the tree to createvalues
- the JSON valuesleafValueMaker
- The function to create the value of a TreeLeaf
AbstractTreeNode
from JSON valuesprivate <T> AbstractTreeNode<T> _create(Map<String,Object> values, Function<TreeMaker.ClientSideCriterionWrapper,T> leafValueMaker)
public Query toQuery(Object value, String stringOperator, BiFunction<Object,Query.Operator,Query> toQuery, String language, Map<String,Object> contextualParameters)
Query.Operator
, then it is just the provided BiFunction
which is applied.
Query.Operator
.
Then, the BiFunction
is applied with the transformed value and the deducted Query.Operator
.value
- The valuestringOperator
- The operator as stringtoQuery
- 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
- Tha languagecontextualParameters
- The contextual parametersprotected static String escapeQueryCharsForLikeQuery(String string, Map<String,Object> contextualParameters)
string
- The string to escape.contextualParameters
- the search contextual parameters.