public abstract class QueryParserBase<QUERYTPYE extends SolrDataQuery> extends Object implements QueryParser
QueryParser providing common functions for creating
SolrQuery.| Modifier and Type | Class and Description |
|---|---|
static interface |
QueryParserBase.PredicateProcessor
QueryParserBase.PredicateProcessor creates a solr reable query string representation for a given Criteria.Predicate |
| Modifier and Type | Field and Description |
|---|---|
protected static String |
BOOST |
protected GenericConversionService |
conversionService |
protected static String |
CRITERIA_VALUE_SEPERATOR |
protected static String |
DELIMINATOR |
protected static String |
NOT |
| Constructor and Description |
|---|
QueryParserBase(MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPredicateProcessor(QueryParserBase.PredicateProcessor processor)
add another
QueryParserBase.PredicateProcessor |
protected void |
appendDefaultOperator(org.apache.solr.client.solrj.SolrQuery solrQuery,
Query.Operator defaultOperator)
Set
q.op parameter for SolrQuery |
protected void |
appendDefType(org.apache.solr.client.solrj.SolrQuery solrQuery,
String defType)
Set
defType for SolrQuery |
protected void |
appendPagination(org.apache.solr.client.solrj.SolrQuery query,
Long offset,
Integer rows)
Append pagination information
start, rows to SolrQuery |
protected void |
appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery,
List<Field> fields)
Deprecated.
|
protected void |
appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery,
List<Field> fields,
Class<?> domainType)
Append field list to
SolrQuery |
protected void |
appendRequestHandler(org.apache.solr.client.solrj.SolrQuery solrQuery,
String requestHandler)
Set request handler parameter for
SolrQuery |
protected void |
appendTimeAllowed(org.apache.solr.client.solrj.SolrQuery solrQuery,
Integer timeAllowed)
Set
SolrQuery.setTimeAllowed(Integer) |
org.apache.solr.client.solrj.SolrQuery |
constructSolrQuery(SolrDataQuery query,
Class<?> domainType)
Convert given Query into a SolrQuery executable via
SolrClient |
protected String |
createCalculatedFieldFragment(CalculatedField calculatedField,
Class<?> domainType)
Create
SolrClient readable String representation for CalculatedField. |
protected String |
createFunctionFragment(Function function,
int level,
Class<?> domainType)
Create
SolrClient readable String representation for Function |
protected String |
createQueryFragmentForCriteria(Criteria part,
Class<?> domainType)
Creates query string representation of a single critiera.
|
protected String |
createQueryStringFromCriteria(Criteria criteria)
Deprecated.
since 4.0. Use
createQueryStringFromCriteria(Criteria, Class) instead. |
protected String |
createQueryStringFromCriteria(Criteria criteria,
Class<?> domainType)
Iterates criteria list and concats query string fragments to form a valid query string to be used with
SolrQuery.setQuery(String) |
String |
createQueryStringFromNode(Node node)
Deprecated.
since 4.0. Use
createQueryStringFromNode(Node, Class) instead |
String |
createQueryStringFromNode(Node node,
Class<?> domainType)
Create the plain query string representation of the given node using mapping information derived from the domain
type.
|
String |
createQueryStringFromNode(Node node,
int position)
Deprecated.
since 4.0. Use
createQueryStringFromNode(Node, int, Class) instead. |
String |
createQueryStringFromNode(Node node,
int position,
Class<?> domainType)
Create the plain query string representation of the given node using mapping information derived from the domain
type.
|
abstract org.apache.solr.client.solrj.SolrQuery |
doConstructSolrQuery(QUERYTPYE query,
Class<?> domainType) |
protected String |
getMappedFieldName(Field field,
Class<?> domainType)
Get the mapped field name using meta information derived from the given domain type.
|
protected String |
getMappedFieldName(String fieldName,
Class<?> domainType)
Get the mapped field name using meta information derived from the given domain type.
|
String |
getQueryString(SolrDataQuery query,
Class<?> domainType)
Get the queryString to use withSolrQuery.setParam(CommonParams.Q, "queryString"}
|
protected String |
prependJoin(String queryString,
SolrDataQuery query,
Class<?> domainType)
Prepend {@code !
|
void |
registerConverter(Converter<?,?> converter)
Register an additional converter for transforming object values to solr readable format
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconstructSolrQuery, getQueryStringprotected static final String CRITERIA_VALUE_SEPERATOR
protected static final String DELIMINATOR
protected static final String NOT
protected static final String BOOST
protected final GenericConversionService conversionService
public QueryParserBase(@Nullable MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext)
mappingContext - public String getQueryString(SolrDataQuery query, @Nullable Class<?> domainType)
QueryParsergetQueryString in interface QueryParserdomainType - used for mapping fields to properties. Can be null.public void registerConverter(Converter<?,?> converter)
QueryParserregisterConverter in interface QueryParserpublic void addPredicateProcessor(QueryParserBase.PredicateProcessor processor)
QueryParserBase.PredicateProcessorprocessor - @Deprecated public String createQueryStringFromNode(Node node)
createQueryStringFromNode(Node, Class) insteadnode - public String createQueryStringFromNode(Node node, @Nullable Class<?> domainType)
node - domainType - can be null.@Deprecated public String createQueryStringFromNode(Node node, int position)
createQueryStringFromNode(Node, int, Class) instead.node - public String createQueryStringFromNode(Node node, int position, @Nullable Class<?> domainType)
node - position - domainType - can be null.@Deprecated protected String createQueryStringFromCriteria(Criteria criteria)
createQueryStringFromCriteria(Criteria, Class) instead.SolrQuery.setQuery(String)criteria - protected String createQueryStringFromCriteria(Criteria criteria, @Nullable Class<?> domainType)
SolrQuery.setQuery(String)criteria - domainType - protected String createQueryFragmentForCriteria(Criteria part, @Nullable Class<?> domainType)
part - domainType - protected String getMappedFieldName(Field field, @Nullable Class<?> domainType)
field - domainType - protected String getMappedFieldName(String fieldName, @Nullable Class<?> domainType)
fieldName - domainType - protected String createCalculatedFieldFragment(CalculatedField calculatedField, @Nullable Class<?> domainType)
SolrClient readable String representation for CalculatedField.calculatedField - protected String createFunctionFragment(Function function, int level, @Nullable Class<?> domainType)
SolrClient readable String representation for Functionfunction - protected String prependJoin(String queryString, @Nullable SolrDataQuery query, @Nullable Class<?> domainType)
!join from= to= to given queryStringqueryString - query - domainType - protected void appendPagination(org.apache.solr.client.solrj.SolrQuery query,
@Nullable
Long offset,
@Nullable
Integer rows)
start, rows to SolrQueryquery - offset - rows - @Deprecated protected void appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery, List<Field> fields)
protected void appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery,
List<Field> fields,
@Nullable
Class<?> domainType)
SolrQuerysolrQuery - fields - protected void appendDefaultOperator(org.apache.solr.client.solrj.SolrQuery solrQuery,
@Nullable
Query.Operator defaultOperator)
q.op parameter for SolrQuerysolrQuery - defaultOperator - protected void appendTimeAllowed(org.apache.solr.client.solrj.SolrQuery solrQuery,
@Nullable
Integer timeAllowed)
SolrQuery.setTimeAllowed(Integer)solrQuery - timeAllowed - protected void appendDefType(org.apache.solr.client.solrj.SolrQuery solrQuery,
@Nullable
String defType)
defType for SolrQuerysolrQuery - defType - protected void appendRequestHandler(org.apache.solr.client.solrj.SolrQuery solrQuery,
@Nullable
String requestHandler)
SolrQuerysolrQuery - requestHandler - public org.apache.solr.client.solrj.SolrQuery constructSolrQuery(SolrDataQuery query, @Nullable Class<?> domainType)
QueryParserSolrClientconstructSolrQuery in interface QueryParserdomainType - used for mapping fields to properties. Can be null.Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.