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 NoblePaul: http://wiki.apache.org/solr/Solrj ------------------------------------------------------------------------------ /!\ Note -- !EmbeddedSolrServer works only with handlers registered in [http://wiki.apache.org/solr/SolrConfigXml solrconfig.xml]. A [http://wiki.apache.org/solr/SolrRequestHandler RequestHandler] must be mapped to /update for a request to /update to function. + = Usage = Solrj is designed as an extendable framework to pass [http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/SolrRequest.html SolrRequest] to the [http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/SolrServer.html SolrServer] and return a [http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/SolrResponse.html SolrResponse]. @@ -78, +79 @@ * Get an instance of server first {{{ SolrServer server = getSolrServer(); + }}} + The `getSolrServer()` method body can be as follows if you use a remote server, + {{{ + public SolrServer getSolrServer(){ + //the instance can be reused + return new CommonsHttpSolrServer(); + } + }}} + + if it is a local server use the following, + {{{ + public SolrServer getSolrServer(){ + //the instance can be reused + return new EmbeddedSolrServer(); + } + }}} + + * If you wish to clean up the index before adding data do this {{{ server.deleteByQuery( "*:*" );// delete everything!
