public class SolrTemplate extends Object implements SolrOperations, InitializingBean, ApplicationContextAware
SolrOperations| Constructor and Description |
|---|
SolrTemplate(org.apache.solr.client.solrj.SolrClient solrClient) |
SolrTemplate(SolrClientFactory solrClientFactory) |
SolrTemplate(SolrClientFactory solrClientFactory,
RequestMethod requestMethod) |
SolrTemplate(SolrClientFactory solrClientFactory,
SolrConverter solrConverter) |
SolrTemplate(SolrClientFactory solrClientFactory,
SolrConverter solrConverter,
RequestMethod defaultRequestMethod) |
SolrTemplate(org.apache.solr.client.solrj.SolrClient solrClient,
RequestMethod requestMethod) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
assertNoCollection(Object o) |
void |
commit(String collection)
Send commit command
SolrClient.commit() |
protected org.apache.solr.client.solrj.SolrQuery |
constructQuery(SolrDataQuery query,
Class<?> domainType)
Create the native
SolrQuery from a given SolrDataQuery. |
org.apache.solr.common.SolrInputDocument |
convertBeanToSolrInputDocument(Object bean)
Convert given bean into a solrj InputDocument
|
<T> List<T> |
convertQueryResponseToBeans(org.apache.solr.client.solrj.response.QueryResponse response,
Class<T> targetClass) |
<T> List<T> |
convertSolrDocumentListToBeans(org.apache.solr.common.SolrDocumentList documents,
Class<T> targetClass) |
<T> T |
convertSolrDocumentToBean(org.apache.solr.common.SolrDocument document,
Class<T> targetClass) |
long |
count(String collection,
SolrDataQuery query,
Class<?> domainType)
return number of elements found by for given query
|
long |
count(String collection,
SolrDataQuery query,
Class<?> domainType,
RequestMethod method)
return number of elements found by for given query
|
org.apache.solr.client.solrj.response.UpdateResponse |
delete(String collection,
SolrDataQuery query,
Class<?> domainType)
Find and delete all objects matching the provided Query.
|
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByIds(String collection,
Collection<String> ids)
Delete objects with given ids
|
org.apache.solr.client.solrj.response.UpdateResponse |
deleteByIds(String collection,
String id)
Detele the one object with provided id.
|
<T> T |
execute(SolrCallback<T> action)
Execute action within callback
|
<T> Optional<T> |
getById(String collection,
Object id,
Class<T> clazz)
Executes a realtime get using given id.
|
<T> Collection<T> |
getByIds(String collection,
Collection<?> ids,
Class<T> clazz)
Executes a realtime get using given ids.
|
SolrConverter |
getConverter() |
RequestMethod |
getDefaultRequestMethod() |
static PersistenceExceptionTranslator |
getExceptionTranslator() |
Set<SolrPersistentEntitySchemaCreator.Feature> |
getSchemaCreationFeatures() |
String |
getSchemaName(String collectionName) |
SchemaOperations |
getSchemaOperations(String collection)
Get the
SchemaOperations executable. |
org.apache.solr.client.solrj.SolrClient |
getSolrClient()
Get the underlying SolrClient instance
|
org.apache.solr.client.solrj.response.SolrPingResponse |
ping()
Execute ping against SolrClient and return duration in msec
|
org.apache.solr.client.solrj.response.SolrPingResponse |
ping(String collection)
Execute ping against SolrClient and return duration in msec
|
<T,S extends Page<T>> |
query(String collection,
Query query,
Class<T> clazz)
Execute the query against Solr and return result as page.
|
<T,S extends Page<T>> |
query(String collection,
Query query,
Class<T> clazz,
RequestMethod method)
Execute the query against Solr and return result as page.
|
<T> Cursor<T> |
queryForCursor(String collection,
Query query,
Class<T> clazz)
|
<T> FacetAndHighlightPage<T> |
queryForFacetAndHighlightPage(String collection,
FacetAndHighlightQuery query,
Class<T> clazz)
Execute a query and highlight matches in result
|
<T> FacetAndHighlightPage<T> |
queryForFacetAndHighlightPage(String collection,
FacetAndHighlightQuery query,
Class<T> clazz,
RequestMethod method)
Execute a query and highlight matches in result
|
<T> FacetPage<T> |
queryForFacetPage(String collection,
FacetQuery query,
Class<T> clazz)
Execute a facet query against solr facet result will be returned along with query result within the FacetPage
|
<T> FacetPage<T> |
queryForFacetPage(String collection,
FacetQuery query,
Class<T> clazz,
RequestMethod method)
Execute a facet query against solr facet result will be returned along with query result within the FacetPage
|
<T> GroupPage<T> |
queryForGroupPage(String collection,
Query query,
Class<T> clazz)
Execute the query against solr and return result as
GroupPage |
<T> GroupPage<T> |
queryForGroupPage(String collection,
Query query,
Class<T> clazz,
RequestMethod method)
Execute the query against solr and return result as
GroupPage |
<T> HighlightPage<T> |
queryForHighlightPage(String collection,
HighlightQuery query,
Class<T> clazz)
Execute a query and highlight matches in result
|
<T> HighlightPage<T> |
queryForHighlightPage(String collection,
HighlightQuery query,
Class<T> clazz,
RequestMethod method)
Execute a query and highlight matches in result
|
<T> Optional<T> |
queryForObject(String collection,
Query query,
Class<T> clazz)
Execute the query against solr and return the first returned object
|
<T> Optional<T> |
queryForObject(String collection,
Query query,
Class<T> clazz,
RequestMethod method)
Execute the query against solr and return the first returned object
|
<T> ScoredPage<T> |
queryForPage(String collection,
Query query,
Class<T> clazz)
Execute the query against solr and retrun result as
Page |
<T> ScoredPage<T> |
queryForPage(String collection,
Query query,
Class<T> clazz,
RequestMethod method)
Execute the query against solr and retrun result as
Page |
<T> StatsPage<T> |
queryForStatsPage(String collection,
Query query,
Class<T> clazz)
Execute the query against Solr and return result as
StatsPage. |
<T> StatsPage<T> |
queryForStatsPage(String collection,
Query query,
Class<T> clazz,
RequestMethod method)
Execute the query against Solr and return result as
StatsPage. |
TermsPage |
queryForTermsPage(String collection,
TermsQuery query)
Execute query using terms handler
|
TermsPage |
queryForTermsPage(String collection,
TermsQuery query,
RequestMethod method)
Execute query using terms handler
|
void |
registerQueryParser(Class<? extends SolrDataQuery> clazz,
QueryParser queryParser) |
void |
rollback(String collection)
send rollback command
SolrClient.rollback() |
org.apache.solr.client.solrj.response.UpdateResponse |
saveBean(String collection,
Object obj,
Duration commitWithin)
Execute add operation against solr, which will do either insert or update with support for commitWithin strategy.
|
org.apache.solr.client.solrj.response.UpdateResponse |
saveBeans(String collection,
Collection<?> beans,
Duration commitWithin)
Add a collection of beans to solr, which will do either insert or update with support for commitWithin strategy.
|
org.apache.solr.client.solrj.response.UpdateResponse |
saveDocument(String collection,
org.apache.solr.common.SolrInputDocument document,
Duration commitWithin)
Add a solrj input document to solr, which will do either insert or update with support for commitWithin strategy
|
org.apache.solr.client.solrj.response.UpdateResponse |
saveDocuments(String collection,
Collection<org.apache.solr.common.SolrInputDocument> documents,
Duration commitWithin)
Add multiple solrj input documents to solr, which will do either insert or update with support for commitWithin
strategy.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setMappingContext(MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext) |
void |
setSchemaCreationFeatures(Collection<SolrPersistentEntitySchemaCreator.Feature> schemaCreationFeatures) |
void |
setSolrConverter(SolrConverter solrConverter) |
void |
softCommit(String collection)
Send soft commmit command
SolrClient.commit(boolean, boolean, boolean) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcount, count, delete, saveBean, saveBeans, saveDocument, saveDocumentspublic SolrTemplate(org.apache.solr.client.solrj.SolrClient solrClient)
public SolrTemplate(org.apache.solr.client.solrj.SolrClient solrClient,
RequestMethod requestMethod)
public SolrTemplate(SolrClientFactory solrClientFactory)
public SolrTemplate(SolrClientFactory solrClientFactory, RequestMethod requestMethod)
public SolrTemplate(SolrClientFactory solrClientFactory, @Nullable SolrConverter solrConverter)
public SolrTemplate(SolrClientFactory solrClientFactory, @Nullable SolrConverter solrConverter, @Nullable RequestMethod defaultRequestMethod)
solrClientFactory - must not be null.solrConverter - must not be null.defaultRequestMethod - can be null. Will be defaulted to RequestMethod.GETpublic <T> T execute(SolrCallback<T> action)
SolrOperationsexecute in interface SolrOperationspublic org.apache.solr.client.solrj.response.SolrPingResponse ping()
SolrOperationsping in interface SolrOperationsSolrPingResponse containing ping result.public org.apache.solr.client.solrj.response.SolrPingResponse ping(String collection)
SolrOperationsping in interface SolrOperationscollection - must not be null.SolrPingResponse containing ping result.public long count(String collection, SolrDataQuery query, @Nullable Class<?> domainType)
SolrOperationscount in interface SolrOperationscollection - must not be null.query - must not be null.domainType - can be null.public long count(String collection, SolrDataQuery query, @Nullable Class<?> domainType, RequestMethod method)
SolrOperationscount in interface SolrOperationscollection - must not be null.query - must not be null.domainType - can be null.method - must not be null.public org.apache.solr.client.solrj.response.UpdateResponse saveBean(String collection, Object obj, Duration commitWithin)
SolrOperationssaveBean in interface SolrOperationscollection - must not be null.obj - must not be null.commitWithin - max time within server performs commit.UpdateResponse containing update result.public org.apache.solr.client.solrj.response.UpdateResponse saveBeans(String collection, Collection<?> beans, Duration commitWithin)
SolrOperationssaveBeans in interface SolrOperationscollection - must not be null.beans - must not be null.commitWithin - max time within server performs commit.UpdateResponse containing update result.public org.apache.solr.client.solrj.response.UpdateResponse saveDocument(String collection, org.apache.solr.common.SolrInputDocument document, Duration commitWithin)
SolrOperationssaveDocument in interface SolrOperationsdocument - must not be null.commitWithin - must not be null.UpdateResponse containing update result.public org.apache.solr.client.solrj.response.UpdateResponse saveDocuments(String collection, Collection<org.apache.solr.common.SolrInputDocument> documents, Duration commitWithin)
SolrOperationssaveDocuments in interface SolrOperationscollection - must not be null.documents - must not be null.commitWithin - max time within server performs commit.UpdateResponse containing update result.public org.apache.solr.client.solrj.response.UpdateResponse delete(String collection, SolrDataQuery query, @Nullable Class<?> domainType)
SolrOperationsdelete in interface SolrOperationscollection - must not be null.query - must not be null.UpdateResponse containing delete result.public org.apache.solr.client.solrj.response.UpdateResponse deleteByIds(String collection, String id)
SolrOperationsdeleteByIds in interface SolrOperationscollection - must not be null.id - must not be null.UpdateResponse containing delete result.public org.apache.solr.client.solrj.response.UpdateResponse deleteByIds(String collection, Collection<String> ids)
SolrOperationsdeleteByIds in interface SolrOperationscollection - must not be null.ids - must not be null.UpdateResponse containing delete result.public <T> Optional<T> queryForObject(String collection, Query query, Class<T> clazz)
SolrOperationsqueryForObject in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> Optional<T> queryForObject(String collection, Query query, Class<T> clazz, RequestMethod method)
SolrOperationsqueryForObject in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> ScoredPage<T> queryForPage(String collection, Query query, Class<T> clazz)
SolrOperationsPagequeryForPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T,S extends Page<T>> S query(String collection, Query query, Class<T> clazz)
SolrOperationsquery in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T,S extends Page<T>> S query(String collection, Query query, Class<T> clazz, RequestMethod method)
SolrOperationsquery in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> ScoredPage<T> queryForPage(String collection, Query query, Class<T> clazz, RequestMethod method)
SolrOperationsPagequeryForPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> GroupPage<T> queryForGroupPage(String collection, Query query, Class<T> clazz)
SolrOperationsGroupPagequeryForGroupPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> GroupPage<T> queryForGroupPage(String collection, Query query, Class<T> clazz, RequestMethod method)
SolrOperationsGroupPagequeryForGroupPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> StatsPage<T> queryForStatsPage(String collection, Query query, Class<T> clazz)
SolrOperationsStatsPage.queryForStatsPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> StatsPage<T> queryForStatsPage(String collection, Query query, Class<T> clazz, RequestMethod method)
SolrOperationsStatsPage.queryForStatsPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> FacetPage<T> queryForFacetPage(String collection, FacetQuery query, Class<T> clazz)
SolrOperationsqueryForFacetPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> FacetPage<T> queryForFacetPage(String collection, FacetQuery query, Class<T> clazz, RequestMethod method)
SolrOperationsqueryForFacetPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> HighlightPage<T> queryForHighlightPage(String collection, HighlightQuery query, Class<T> clazz)
SolrOperationsqueryForHighlightPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> HighlightPage<T> queryForHighlightPage(String collection, HighlightQuery query, Class<T> clazz, RequestMethod method)
SolrOperationsqueryForHighlightPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public <T> FacetAndHighlightPage<T> queryForFacetAndHighlightPage(String collection, FacetAndHighlightQuery query, Class<T> clazz)
SolrOperationsqueryForFacetAndHighlightPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> FacetAndHighlightPage<T> queryForFacetAndHighlightPage(String collection, FacetAndHighlightQuery query, Class<T> clazz, RequestMethod method)
SolrOperationsqueryForFacetAndHighlightPage in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.method - must not be null.public TermsPage queryForTermsPage(String collection, TermsQuery query)
SolrOperationsqueryForTermsPage in interface SolrOperationscollection - must not be null.query - must not be null.public TermsPage queryForTermsPage(String collection, TermsQuery query, RequestMethod method)
SolrOperationsqueryForTermsPage in interface SolrOperationscollection - must not be null.query - must not be null.method - must not be null.protected org.apache.solr.client.solrj.SolrQuery constructQuery(SolrDataQuery query, @Nullable Class<?> domainType)
SolrQuery from a given SolrDataQuery.query - never null.public void commit(String collection)
SolrOperationsSolrClient.commit()commit in interface SolrOperationspublic void softCommit(String collection)
SolrOperationsSolrClient.commit(boolean, boolean, boolean)softCommit in interface SolrOperationspublic void rollback(String collection)
SolrOperationsSolrClient.rollback()rollback in interface SolrOperationspublic org.apache.solr.common.SolrInputDocument convertBeanToSolrInputDocument(Object bean)
SolrOperationsconvertBeanToSolrInputDocument in interface SolrOperationspublic String getSchemaName(String collectionName)
collectionName - public <T> Cursor<T> queryForCursor(String collection, Query query, Class<T> clazz)
SolrOperationsQuery and returns an open Cursor allowing to iterate of results, dynamically
fetching additional ones if required.queryForCursor in interface SolrOperationscollection - must not be null.query - must not be null.clazz - must not be null.public <T> Collection<T> getByIds(String collection, Collection<?> ids, Class<T> clazz)
SolrOperationsgetByIds in interface SolrOperationscollection - must not be null.ids - must not be null.clazz - must not be null.public <T> Optional<T> getById(String collection, Object id, Class<T> clazz)
SolrOperationsgetById in interface SolrOperationscollection - must not be null.id - must not be null.clazz - must not be null.public SchemaOperations getSchemaOperations(String collection)
SolrOperationsSchemaOperations executable.getSchemaOperations in interface SolrOperationspublic <T> List<T> convertQueryResponseToBeans(org.apache.solr.client.solrj.response.QueryResponse response, Class<T> targetClass)
public <T> List<T> convertSolrDocumentListToBeans(org.apache.solr.common.SolrDocumentList documents, Class<T> targetClass)
public <T> T convertSolrDocumentToBean(org.apache.solr.common.SolrDocument document,
Class<T> targetClass)
protected void assertNoCollection(Object o)
public final org.apache.solr.client.solrj.SolrClient getSolrClient()
SolrOperationsgetSolrClient in interface SolrOperationsSolrClient in use. Never null.public SolrConverter getConverter()
getConverter in interface SolrOperationspublic static PersistenceExceptionTranslator getExceptionTranslator()
public void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext in interface ApplicationContextAwarepublic void registerQueryParser(Class<? extends SolrDataQuery> clazz, QueryParser queryParser)
public void setSolrConverter(SolrConverter solrConverter)
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic void setMappingContext(MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext)
mappingContext - public void setSchemaCreationFeatures(Collection<SolrPersistentEntitySchemaCreator.Feature> schemaCreationFeatures)
schemaCreationFeatures - public Set<SolrPersistentEntitySchemaCreator.Feature> getSchemaCreationFeatures()
public RequestMethod getDefaultRequestMethod()
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.