public class SolrQueryBuilder extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SolrQueryBuilder.RequestHandlerType
Type of the request handler.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
QUERY_ALL
Solr query selector for all items
|
static char |
SEPARATOR_SOLR_FIELD_VALUE
Separator for solr fields and values
|
static char |
SOLR_WILD_CARD
Solr wild card
|
Constructor and Description |
---|
SolrQueryBuilder()
same as calling the overloaded constructor with parameter null (without relation map)
|
SolrQueryBuilder(java.util.Map<java.lang.String,java.lang.String> elementFieldMap)
Note: the given map is ASSUMED to be escaped and to contain only valid element names and field names
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomFilter(AbstractQueryFilter filter)
Add new filter query.
|
void |
addField(java.lang.String field)
Add field to be selected in the response.
|
void |
addFields(java.lang.String... fields)
Add a list of fields to be selected in the response
|
void |
addSortOption(SortOptions.Option option) |
void |
clearCustomFilters()
clear the list of currently set custom filters
|
static org.apache.solr.client.solrj.SolrQuery.ORDER |
fromOrderDirection(SQLSelectBuilder.OrderDirection direction)
Can be used to convert SQL OrderDirection to SOLR ORDER clause.
|
boolean |
isUseExtendedDismax() |
void |
setLimits(Limits limits) |
void |
setQueryParameter(QueryParameter queryParameter) |
static org.apache.solr.client.solrj.SolrQuery |
setRequestHandler(org.apache.solr.client.solrj.SolrQuery query,
SolrQueryBuilder.RequestHandlerType type)
Helper method to set the correct path for different kinds of request handlers (mainly for suggest-handler)
|
void |
setSortOptions(SortOptions sortOptions) |
void |
setUseExtendedDismax(boolean useExtendedDismax)
Setter for the use of enabling Extended Query Parser (edismax).
|
org.apache.solr.client.solrj.SolrQuery |
toSolrQuery()
get an executable SolrQuery from the builder
|
org.apache.solr.client.solrj.SolrQuery |
toSolrQuery(java.lang.String type)
Get the query using a specified type parameter for sort and limit operations.
|
public static final char SEPARATOR_SOLR_FIELD_VALUE
public static final java.lang.String QUERY_ALL
public static final char SOLR_WILD_CARD
public SolrQueryBuilder(java.util.Map<java.lang.String,java.lang.String> elementFieldMap)
elementFieldMap
- map of element-solr field relationspublic SolrQueryBuilder()
public void addSortOption(SortOptions.Option option)
option
- public void addField(java.lang.String field)
field
- public void addFields(java.lang.String... fields)
fields
- public void setQueryParameter(QueryParameter queryParameter)
queryParameter
- the query to setpublic void setSortOptions(SortOptions sortOptions)
sortOptions
- the sortOptions to setpublic boolean isUseExtendedDismax()
public void setUseExtendedDismax(boolean useExtendedDismax)
useExtendedDismax
- public void addCustomFilter(AbstractQueryFilter filter)
filter
- public void clearCustomFilters()
public org.apache.solr.client.solrj.SolrQuery toSolrQuery(java.lang.String type) throws java.lang.IllegalArgumentException
type
- the type or nulljava.lang.IllegalArgumentException
- on bad query valuepublic org.apache.solr.client.solrj.SolrQuery toSolrQuery()
public static org.apache.solr.client.solrj.SolrQuery.ORDER fromOrderDirection(SQLSelectBuilder.OrderDirection direction) throws java.lang.UnsupportedOperationException
direction
- java.lang.UnsupportedOperationException
public static org.apache.solr.client.solrj.SolrQuery setRequestHandler(org.apache.solr.client.solrj.SolrQuery query, SolrQueryBuilder.RequestHandlerType type)
query
- type
- Copyright © 2015 Tampere University of Technology, Pori Department.