## org.apache.solr.client.solrj
Class SolrServer

    java.lang.Object
      org.apache.solr.client.solrj.SolrServer

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  CommonsHttpSolrServer, LBHttpSolrServer

    public abstract class SolrServer

extends Object
implements Serializable

Since:
  solr 1.3
Version:
  $Id: SolrServer.java 1170589 2011-09-14 13:03:51Z janhoy $
See Also:
  Serialized Form

Constructor Summary
`SolrServer()`

Method Summary
`UpdateResponse` `add(Collection<SolrInputDocument> docs)` Adds a collection of documents
`UpdateResponse` `add(Collection<SolrInputDocument> docs, int commitWithinMs)` Adds a collection of documents, specifying max time before they become committed
`UpdateResponse` `add(SolrInputDocument doc)` Adds a single document
`UpdateResponse` `add(SolrInputDocument doc, int commitWithinMs)` Adds a single document specifying max time before it becomes committed
`UpdateResponse` `addBean(Object obj)` Adds a single bean
`UpdateResponse` `addBean(Object obj, int commitWithinMs)` Adds a single bean specifying max time before it becomes committed
`UpdateResponse` `addBeans(Collection<?> beans)` Adds a collection of beans
`UpdateResponse` `addBeans(Collection<?> beans, int commitWithinMs)` Adds a collection of beans specifying max time before they become committed
`UpdateResponse` `commit()` Performs an explicit commit, causing pending documents to be committed for indexing
`UpdateResponse` `commit(boolean waitFlush, boolean waitSearcher)` Performs an explicit commit, causing pending documents to be committed for indexing
`UpdateResponse` `deleteById(List<String> ids)` Deletes a list of documents by unique ID
`UpdateResponse` `deleteById(String id)` Deletes a single document by unique ID
`UpdateResponse` `deleteByQuery(String query)` Deletes documents from the index based on a query
`DocumentObjectBinder` `getBinder()`
`UpdateResponse` `optimize()` Performs an explicit optimize, causing a merge of all segments to one.
`UpdateResponse` `optimize(boolean waitFlush, boolean waitSearcher)` Performs an explicit optimize, causing a merge of all segments to one.
`UpdateResponse` `optimize(boolean waitFlush, boolean waitSearcher, int maxSegments)` Performs an explicit optimize, causing a merge of all segments to one.
`SolrPingResponse` `ping()` Issues a ping request to check if the server is alive
`QueryResponse` `query(SolrParams params)` Performs a query to the Solr server
`QueryResponse` `query(SolrParams params, SolrRequest.METHOD method)` Performs a query to the Solr server
`abstract NamedList<Object>` `request(SolrRequest request)` SolrServer implementations need to implement how a request is actually processed
`UpdateResponse` `rollback()` Performs a rollback of all non-committed documents pending.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SolrServer

    public SolrServer()

Method Detail

### add

    public UpdateResponse add(Collection<SolrInputDocument> docs)
                       throws SolrServerException,
                              IOException

  Adds a collection of documents

  Parameters:
    `docs` - the collection of documents
  Throws:
    `SolrServerException`
    `IOException`

### add

    public UpdateResponse add(Collection<SolrInputDocument> docs,
                              int commitWithinMs)
                       throws SolrServerException,
                              IOException

  Adds a collection of documents, specifying max time before they become committed

  Parameters:
    `docs` - the collection of documents
    `commitWithinMs` - max time (in ms) before a commit will happen
  Throws:
    `SolrServerException`
    `IOException`
  Since:
    solr 3.5

### addBeans

    public UpdateResponse addBeans(Collection<?> beans)
                            throws SolrServerException,
                                   IOException

  Adds a collection of beans

  Parameters:
    `beans` - the collection of beans
  Throws:
    `SolrServerException`
    `IOException`

### addBeans

    public UpdateResponse addBeans(Collection<?> beans,
                                   int commitWithinMs)
                            throws SolrServerException,
                                   IOException

  Adds a collection of beans specifying max time before they become committed

  Parameters:
    `beans` - the collection of beans
    `commitWithinMs` - max time (in ms) before a commit will happen
  Throws:
    `SolrServerException`
    `IOException`
  Since:
    solr 3.5

### add

    public UpdateResponse add(SolrInputDocument doc)
                       throws SolrServerException,
                              IOException

  Adds a single document

  Parameters:
    `doc` - the input document
  Throws:
    `SolrServerException`
    `IOException`

### add

    public UpdateResponse add(SolrInputDocument doc,
                              int commitWithinMs)
                       throws SolrServerException,
                              IOException

  Adds a single document specifying max time before it becomes committed

  Parameters:
    `doc` - the input document
    `commitWithinMs` - max time (in ms) before a commit will happen
  Throws:
    `SolrServerException`
    `IOException`
  Since:
    solr 3.5

### addBean

    public UpdateResponse addBean(Object obj)
                           throws IOException,
                                  SolrServerException

  Adds a single bean

  Parameters:
    `obj` - the input bean
  Throws:
    `SolrServerException`
    `IOException`

### addBean

    public UpdateResponse addBean(Object obj,
                                  int commitWithinMs)
                           throws IOException,
                                  SolrServerException

  Adds a single bean specifying max time before it becomes committed

  Parameters:
    `obj` - the input bean
    `commitWithinMs` - max time (in ms) before a commit will happen
  Throws:
    `SolrServerException`
    `IOException`
  Since:
    solr 3.5

### commit

    public UpdateResponse commit()
                          throws SolrServerException,
                                 IOException

  Performs an explicit commit, causing pending documents to be committed for indexing

  waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access

  Throws:
    `SolrServerException`
    `IOException`

### optimize

    public UpdateResponse optimize()
                            throws SolrServerException,
                                   IOException

  Performs an explicit optimize, causing a merge of all segments to one.

  waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access

  Note: In most cases it is not required to do explicit optimize

  Throws:
    `SolrServerException`
    `IOException`

### commit

    public UpdateResponse commit(boolean waitFlush,
                                 boolean waitSearcher)
                          throws SolrServerException,
                                 IOException

  Performs an explicit commit, causing pending documents to be committed for indexing

  Parameters:
    `waitFlush` - block until index changes are flushed to disk
    `waitSearcher` - block until a new searcher is opened and registered as the main query searcher, making the changes visible
  Throws:
    `SolrServerException`
    `IOException`

### optimize

    public UpdateResponse optimize(boolean waitFlush,
                                   boolean waitSearcher)
                            throws SolrServerException,
                                   IOException

  Performs an explicit optimize, causing a merge of all segments to one.

  Note: In most cases it is not required to do explicit optimize

  Parameters:
    `waitFlush` - block until index changes are flushed to disk
    `waitSearcher` - block until a new searcher is opened and registered as the main query searcher, making the changes visible
  Throws:
    `SolrServerException`
    `IOException`

### optimize

    public UpdateResponse optimize(boolean waitFlush,
                                   boolean waitSearcher,
                                   int maxSegments)
                            throws SolrServerException,
                                   IOException

  Performs an explicit optimize, causing a merge of all segments to one.

  Note: In most cases it is not required to do explicit optimize

  Parameters:
    `waitFlush` - block until index changes are flushed to disk
    `waitSearcher` - block until a new searcher is opened and registered as the main query searcher, making the changes visible
    `maxSegments` - optimizes down to at most this number of segments
  Throws:
    `SolrServerException`
    `IOException`

### rollback

    public UpdateResponse rollback()
                            throws SolrServerException,
                                   IOException

  Performs a rollback of all non-committed documents pending.

  Note that this is not a true rollback as in databases. Content you have previously added may have been committed due to autoCommit, buffer full, other client performing a commit etc.

  Throws:
    `SolrServerException`
    `IOException`

### deleteById

    public UpdateResponse deleteById(String id)
                              throws SolrServerException,
                                     IOException

  Deletes a single document by unique ID

  Parameters:
    `id` - the ID of the document to delete
  Throws:
    `SolrServerException`
    `IOException`

### deleteById

    public UpdateResponse deleteById(List<String> ids)
                              throws SolrServerException,
                                     IOException

  Deletes a list of documents by unique ID

  Parameters:
    `ids` - the list of document IDs to delete
  Throws:
    `SolrServerException`
    `IOException`

### deleteByQuery

    public UpdateResponse deleteByQuery(String query)
                                 throws SolrServerException,
                                        IOException

  Deletes documents from the index based on a query

  Parameters:
    `query` - the query expressing what documents to delete
  Throws:
    `SolrServerException`
    `IOException`

### ping

    public SolrPingResponse ping()
                          throws SolrServerException,
                                 IOException

  Issues a ping request to check if the server is alive

  Throws:
    `SolrServerException`
    `IOException`

### query

    public QueryResponse query(SolrParams params)
                        throws SolrServerException

  Performs a query to the Solr server

  Parameters:
    `params` - an object holding all key/value parameters to send along the request
  Throws:
    `SolrServerException`

### query

    public QueryResponse query(SolrParams params,
                               SolrRequest.METHOD method)
                        throws SolrServerException

  Performs a query to the Solr server

  Parameters:
    `params` - an object holding all key/value parameters to send along the request
    `method` - specifies the HTTP method to use for the request, such as GET or POST
  Throws:
    `SolrServerException`

### request

    public abstract NamedList<Object> request(SolrRequest request)
                                       throws SolrServerException,
                                              IOException

  SolrServer implementations need to implement how a request is actually processed

  Throws:
    `SolrServerException`
    `IOException`

### getBinder

    public DocumentObjectBinder getBinder()

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.