Spring Data Solr

org.springframework.data.solr.core
Interface SolrOperations

All Known Implementing Classes:
SolrTemplate

public interface SolrOperations

Interface that specifies a basic set of Solr operations.

Author:
Christoph Strobl, Joachim Uhrlass

Method Summary
 void commit()
          Send commit command SolrServer.commit()
 org.apache.solr.common.SolrInputDocument convertBeanToSolrInputDocument(Object bean)
          Convert given bean into a solrj InputDocument
 long count(SolrDataQuery query)
          return number of elements found by for given query
 org.apache.solr.client.solrj.response.UpdateResponse delete(SolrDataQuery query)
          Find and delete all objects matching the provided Query
 org.apache.solr.client.solrj.response.UpdateResponse deleteById(Collection<String> id)
          Delete objects with given ids
 org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id)
          Detele the one object with provided id
<T> T
execute(SolrCallback<T> action)
          Execute action within callback
 SolrConverter getConverter()
           
 org.apache.solr.client.solrj.SolrServer getSolrServer()
          Get the underlying SolrServer instance
 org.apache.solr.client.solrj.response.SolrPingResponse ping()
          Execute ping against solrServer and return duration in msec
<T> FacetPage<T>
queryForFacetPage(FacetQuery query, Class<T> clazz)
          Execute a facet query against solr facet result will be returned along with query result within the FacetPage
<T> HighlightPage<T>
queryForHighlightPage(HighlightQuery query, Class<T> clazz)
          Execute a query and highlight matches in result
<T> T
queryForObject(Query query, Class<T> clazz)
          Execute the query against solr and return the first returned object
<T> Page<T>
queryForPage(Query query, Class<T> clazz)
          Execute the query against solr and retrun result as Page
 TermsPage queryForTermsPage(TermsQuery query)
          Execute query using terms handler
 void rollback()
          send rollback command SolrServer.rollback()
 org.apache.solr.client.solrj.response.UpdateResponse saveBean(Object obj)
          Execute add operation against solr, which will do either insert or update
 org.apache.solr.client.solrj.response.UpdateResponse saveBean(Object obj, int commitWithinMs)
          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(Collection<?> beans)
          Add a collection of beans to solr, which will do either insert or update
 org.apache.solr.client.solrj.response.UpdateResponse saveBeans(Collection<?> beans, int commitWithinMs)
          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(org.apache.solr.common.SolrInputDocument document)
          Add a solrj input document to solr, which will do either insert or update
 org.apache.solr.client.solrj.response.UpdateResponse saveDocument(org.apache.solr.common.SolrInputDocument document, int commitWithinMs)
          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(Collection<org.apache.solr.common.SolrInputDocument> documents)
          Add multiple solrj input documents to solr, which will do either insert or update
 org.apache.solr.client.solrj.response.UpdateResponse saveDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents, int commitWithinMs)
          Add multiple solrj input documents to solr, which will do either insert or update with support for commitWithin strategy
 void softCommit()
          Send soft commmit command SolrServer.commit(boolean, boolean, boolean)
 

Method Detail

getSolrServer

org.apache.solr.client.solrj.SolrServer getSolrServer()
Get the underlying SolrServer instance

Returns:

ping

org.apache.solr.client.solrj.response.SolrPingResponse ping()
Execute ping against solrServer and return duration in msec

Returns:

count

long count(SolrDataQuery query)
return number of elements found by for given query

Parameters:
query -
Returns:

saveBean

org.apache.solr.client.solrj.response.UpdateResponse saveBean(Object obj)
Execute add operation against solr, which will do either insert or update

Parameters:
obj -
Returns:

saveBean

org.apache.solr.client.solrj.response.UpdateResponse saveBean(Object obj,
                                                              int commitWithinMs)
Execute add operation against solr, which will do either insert or update with support for commitWithin strategy

Parameters:
obj -
commitWithinMs -
Returns:

saveBeans

org.apache.solr.client.solrj.response.UpdateResponse saveBeans(Collection<?> beans)
Add a collection of beans to solr, which will do either insert or update

Parameters:
beans -
Returns:

saveBeans

org.apache.solr.client.solrj.response.UpdateResponse saveBeans(Collection<?> beans,
                                                               int commitWithinMs)
Add a collection of beans to solr, which will do either insert or update with support for commitWithin strategy

Parameters:
beans -
commitWithinMs -
Returns:

saveDocument

org.apache.solr.client.solrj.response.UpdateResponse saveDocument(org.apache.solr.common.SolrInputDocument document)
Add a solrj input document to solr, which will do either insert or update

Parameters:
document -
Returns:

saveDocument

org.apache.solr.client.solrj.response.UpdateResponse saveDocument(org.apache.solr.common.SolrInputDocument document,
                                                                  int commitWithinMs)
Add a solrj input document to solr, which will do either insert or update with support for commitWithin strategy

Parameters:
document -
commitWithinMs -
Returns:

saveDocuments

org.apache.solr.client.solrj.response.UpdateResponse saveDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents)
Add multiple solrj input documents to solr, which will do either insert or update

Parameters:
documents -
Returns:

saveDocuments

org.apache.solr.client.solrj.response.UpdateResponse saveDocuments(Collection<org.apache.solr.common.SolrInputDocument> documents,
                                                                   int commitWithinMs)
Add multiple solrj input documents to solr, which will do either insert or update with support for commitWithin strategy

Parameters:
documents -
Returns:

delete

org.apache.solr.client.solrj.response.UpdateResponse delete(SolrDataQuery query)
Find and delete all objects matching the provided Query

Parameters:
query -
Returns:

deleteById

org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id)
Detele the one object with provided id

Parameters:
id -
Returns:

deleteById

org.apache.solr.client.solrj.response.UpdateResponse deleteById(Collection<String> id)
Delete objects with given ids

Parameters:
id -
Returns:

queryForObject

<T> T queryForObject(Query query,
                     Class<T> clazz)
Execute the query against solr and return the first returned object

Parameters:
query -
clazz -
Returns:
the first matching object

queryForPage

<T> Page<T> queryForPage(Query query,
                         Class<T> clazz)
Execute the query against solr and retrun result as Page

Parameters:
query -
clazz -
Returns:

queryForFacetPage

<T> FacetPage<T> queryForFacetPage(FacetQuery query,
                                   Class<T> clazz)
Execute a facet query against solr facet result will be returned along with query result within the FacetPage

Parameters:
query -
clazz -
Returns:

queryForHighlightPage

<T> HighlightPage<T> queryForHighlightPage(HighlightQuery query,
                                           Class<T> clazz)
Execute a query and highlight matches in result

Parameters:
query -
clazz -
Returns:

queryForTermsPage

TermsPage queryForTermsPage(TermsQuery query)
Execute query using terms handler

Parameters:
query -
Returns:

commit

void commit()
Send commit command SolrServer.commit()


softCommit

void softCommit()
Send soft commmit command SolrServer.commit(boolean, boolean, boolean)


rollback

void rollback()
send rollback command SolrServer.rollback()


convertBeanToSolrInputDocument

org.apache.solr.common.SolrInputDocument convertBeanToSolrInputDocument(Object bean)
Convert given bean into a solrj InputDocument

Parameters:
bean -
Returns:

getConverter

SolrConverter getConverter()
Returns:
Converter in use

execute

<T> T execute(SolrCallback<T> action)
Execute action within callback

Parameters:
action -
Returns:

Spring Data Solr

Copyright © 2011-2014-2014 Pivotal. All Rights Reserved.