You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2012/12/28 17:31:50 UTC

[Solr Wiki] Update of "Solrj" by ShawnHeisey

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 ShawnHeisey:
http://wiki.apache.org/solr/Solrj?action=diff&rev1=67&rev2=68

Comment:
cross-version compatibility notes, also made it clear that most available server settings should not normally be changed.

  
  For information on using SolrJ with Solr1.3 and Solr1.2, see the [[http://wiki.apache.org/solr/Solrj1.3|Solrj1.3]] page.
  
+ = SolrJ/Solr cross-version compatibility =
+ 
+ Except for a requirement to use the XML response parser when you have version 1.4.1 or older on one side and 3.1 or later on the other, there should not be any problems from using a newer SolrJ with an older server version.
+ 
+ If both sides are 3.1 or later, there should also be no problem using an older SolrJ against a newer server, unless you require new server features that are not available in the older SolrJ.  The most likely feature you might need from SolrJ 4.0 that you won't find in older versions is the new setRequestHandler method on SolrQuery objects.  It's worth noting that this method is even useful if your server is running an older version.
  
  = Setting the classpath =
  
@@ -98, +103 @@

  {{{
    String url = "http://localhost:8983/solr"
    HttpSolrServer server = new HttpSolrServer( url );
+   server.setMaxRetries(1); // defaults to 0.  > 1 not recommended.
+   server.setConnectionTimeout(5000); // 5 seconds to establish TCP
+   // Setting the XML response parser is only required for cross
+   // version compatibility and only when one side is 1.4.1 or
+   // earlier and the other side is 3.1 or later.
+   server.setParser(new XMLResponseParser()); // binary parser is used by default
+   // The following settings are provided here for completeness.
+   // They will not normally be required, and should only be used 
+   // after consulting javadocs to know whether they are truly required.
    server.setSoTimeout(1000);  // socket read timeout
-   server.setConnectionTimeout(100);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false);  // defaults to false
    // allowCompression defaults to false.
    // Server side must support gzip or deflate for this to have any effect.
    server.setAllowCompression(true);
-   server.setMaxRetries(1); // defaults to 0.  > 1 not recommended.
-   server.setParser(new XMLResponseParser()); // binary parser is used by default
  }}}
  <<Anchor(EmbeddedSolrServer)>>