lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "Solrj" by RonKuris
Date Sun, 25 Sep 2011 05:00:18 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "Solrj" page has been changed by RonKuris:
http://wiki.apache.org/solr/Solrj?action=diff&rev1=62&rev2=63

Comment:
Added required argument to CommonsHttpSolrServer in example

  For simplicity, the most common commands are modeled in the [[http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/SolrServer.html|SolrServer]]:
  
  == Adding Data to Solr ==
-  * Get an instance of server first
+  * Get an instance of server first.  For a local server, use CommonsHttpSolrServer:
  
  {{{
+     SolrServer server = new CommonsHttpSolrServer("http://HOST:8983/solr/");
+ }}}
+ 
+  * To use a local, embedded server instead:
+ 
+ {{{
-     SolrServer server = getSolrServer();
+     SolrServer server = new EmbeddedSolrServer();
  }}}
- The `getSolrServer()` method body can be as follows if you use a remote server,
+  * If you wish to delete all the data from the index, do this
  
  {{{
- 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!
+     server.deleteByQuery( "*:*" );// CAUTION: deletes everything!
  }}}
   * Construct a document
  

Mime
View raw message