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() |
| 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,
Integer offset,
Integer rows)
Append pagination information
start, rows to SolrQuery |
protected void |
appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery,
List<Field> fields)
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)
Convert given Query into a SolrQuery executable via
SolrClient |
protected String |
createCalculatedFieldFragment(CalculatedField calculatedField)
Create
SolrClient readable String representation for CalculatedField. |
protected String |
createFunctionFragment(Function function,
int level)
Create
SolrClient readable String representation for Function |
protected String |
createQueryFragmentForCriteria(Criteria part)
Creates query string representation of a single critiera
|
protected String |
createQueryStringFromCriteria(Criteria criteria)
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) |
String |
createQueryStringFromNode(Node node,
int position) |
abstract org.apache.solr.client.solrj.SolrQuery |
doConstructSolrQuery(QUERYTPYE query) |
String |
getQueryString(SolrDataQuery query)
Get the queryString to use withSolrQuery.setParam(CommonParams.Q, "queryString"}
|
protected String |
prependJoin(String queryString,
SolrDataQuery query)
Prepend {@code !
|
void |
registerConverter(Converter<?,?> converter)
Register an additional converter for transforming object values to solr readable format
|
protected 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 String getQueryString(SolrDataQuery query)
QueryParsergetQueryString in interface QueryParserpublic void registerConverter(Converter<?,?> converter)
QueryParserregisterConverter in interface QueryParserpublic void addPredicateProcessor(QueryParserBase.PredicateProcessor processor)
QueryParserBase.PredicateProcessorprocessor - protected String createQueryStringFromCriteria(Criteria criteria)
SolrQuery.setQuery(String)criteria - protected String createQueryFragmentForCriteria(Criteria part)
criteria - protected String createCalculatedFieldFragment(CalculatedField calculatedField)
SolrClient readable String representation for CalculatedField.calculatedField - protected String createFunctionFragment(Function function, int level)
SolrClient readable String representation for Functionfunction - protected String prependJoin(String queryString, SolrDataQuery query)
!join from= to= to given queryStringqueryString - query - protected void appendPagination(org.apache.solr.client.solrj.SolrQuery query,
Integer offset,
Integer rows)
start, rows to SolrQueryquery - offset - rows - protected void appendProjectionOnFields(org.apache.solr.client.solrj.SolrQuery solrQuery,
List<Field> fields)
SolrQuerysolrQuery - fields - protected void appendDefaultOperator(org.apache.solr.client.solrj.SolrQuery solrQuery,
Query.Operator defaultOperator)
q.op parameter for SolrQuerysolrQuery - defaultOperator - protected void appendTimeAllowed(org.apache.solr.client.solrj.SolrQuery solrQuery,
Integer timeAllowed)
SolrQuery.setTimeAllowed(Integer)solrQuery - timeAllowed - protected void appendDefType(org.apache.solr.client.solrj.SolrQuery solrQuery,
String defType)
defType for SolrQuerysolrQuery - defType - protected void appendRequestHandler(org.apache.solr.client.solrj.SolrQuery solrQuery,
String requestHandler)
SolrQuerysolrQuery - requestHandler - public org.apache.solr.client.solrj.SolrQuery constructSolrQuery(SolrDataQuery query)
QueryParserSolrClientconstructSolrQuery in interface QueryParserpublic abstract org.apache.solr.client.solrj.SolrQuery doConstructSolrQuery(QUERYTPYE query)
Copyright © 2011-2015–2017 Pivotal Software, Inc.. All rights reserved.