Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The following page has been changed by ryan: http://wiki.apache.org/solr/Solrj ------------------------------------------------------------------------------ /!\ TODO - coming soon... + + Solrj is designed as an extendable framework to pass [http://svn.apache.org/repos/asf/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/SolrRequest.java SolrRequest] to the [http://svn.apache.org/repos/asf/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java SolrServer] and return a [http://svn.apache.org/repos/asf/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/SolrResponse.java SolrResponse]. + + For simplicity, the most common commands are modeled in the [http://svn.apache.org/repos/asf/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java SolrServer]: + + {{{ + public interface SolrServer + { + UpdateResponse add( SolrInputDocument doc ); + UpdateResponse add( Collection<SolrInputDocument> docs ); + UpdateResponse add( SolrInputDocument doc, boolean overwrite ); + UpdateResponse add( Collection<SolrInputDocument> docs, boolean overwrite ); + UpdateResponse deleteById( String id ); + UpdateResponse deleteByQuery( String query ); + UpdateResponse commit( boolean waitFlush, boolean waitSearcher ); + UpdateResponse optimize( boolean waitFlush, boolean waitSearcher ); + UpdateResponse commit( ); + UpdateResponse optimize( ); + QueryResponse query( SolrParams params ); + SolrPingResponse ping(); + } + }}} + + For custom handlers or if you need access to functions not exposed in the !SolrServer, you need to work directly with the [http://svn.apache.org/repos/asf/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/SolrRequest.java SolrRequest] and call: + {{{ + request.process( server ); + }}} + + For example, if to immediately commit after adding documents, you could use: + {{{ + SolrServer server = ... + + UpdateRequest req = new UpdateRequest(); + req.setAction( UpdateRequest.ACTION.COMMIT, false, false ); + req.add( docs ); + UpdateResponse rsp = req.process( server ); + + }}} + + + ------- + + + (from the test cases) {{{
