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 JSharp
Date Wed, 14 Jul 2010 00:15:00 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 JSharp.
The comment on this change is: Moved old solrj release info to new page; Moved dependency
info to the top.
http://wiki.apache.org/solr/Solrj?action=diff&rev1=50&rev2=51

--------------------------------------------------

- <!> [[Solr1.3]]
+ <!> [[Solr1.4]]
  
  <<TableOfContents>>
  
- Solrj is a java client to access solr. It offers a java interface to add, update, and query
the solr index.
+ Solrj is a java client to access solr. It offers a java interface to add, update, and query
the solr index. This page describes the use of the SolrJ releases included with Solr 1.4.x
releases, with the 1.4.x war files.
+ 
+ For information on using SolrJ with Solr1.3 and Solr1.2, see the [[http://wiki.apache.org/solr/Solrj1.3|Solrj1.3]]
page.
+ 
+ 
+ = Setting the classpath =
+ == Ant ==
+ 
+ The jars required in the classpath for SolrJ are,
+ 
+  * commons-codec-1.3.jar (*)
+  * commons-fileupload-1.2.1.jar
+  * commons-httpclient-3.1.jar (*)
+   * commons-logging-1.0.4.jar
+  * commons-io-1.4.jar (*)
+  * geronimo-stax-api_1.0_spec-1.0.1.jar (*)
+  * solr-solrj-1.4.0.jar (+)
+  * wstx-asl-3.2.7.jar (*)
+   * stax-api-1.0.1.jar
+  * slf4j-api-1.5.5.jar (*)
+  * slf4j-simple-1.5.5.jar 
+ 
+ Note that only the jars marked with an asterisk are located in dist/solrj-lib directory
of the Solr 1.4.0 download. solr-solrj-1.4.0.jar can be found in the dist directory.
+ 
+ '''TODO:''' The three unmarked jars are missing in dist/solrj-lib.
+ 
+ == Maven ==
+ Solrj is available in the official Maven repository. Add the following dependency to your
pom.xml to use SolrJ
+ 
+ {{{
+         <dependency>
+                <artifactId>solr-solrj</artifactId>
+                <groupId>org.apache.solr</groupId>
+                <version>1.4.0</version>
+                <type>jar</type>
+                <scope>compile</scope>
+         </dependency>
+ }}}
+ If you need to use the !EmbeddedSolrServer, you need to add the solr-core dependency too.
+ 
+ {{{
+         <dependency>
+                <artifactId>solr-core</artifactId>
+                <groupId>org.apache.solr</groupId>
+                <version>1.4.0</version>
+                <type>jar</type>
+                <scope>compile</scope>
+         </dependency>
+ }}}
+ 
+ If you see any exceptions saying NoClassDefFoundError, you will also need to include:
+ {{{
+         <dependency>
+             <groupId>org.slf4j</groupId>
+             <artifactId>slf4j-simple</artifactId>
+             <version>1.5.6</version>
+         </dependency> 
+ }}}
  
  = CommonsHttpSolrServer =
  The [[http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/CommonsHttpSolrServer.html|CommonsHttpSolrServer]]
uses the [[http://jakarta.apache.org/httpcomponents/httpclient-3.x/|Apache Commons HTTP Client]]
to connect to solr.
@@ -20, +77 @@

    */
    SolrServer server = new CommonsHttpSolrServer( url );
  }}}
- <<Anchor(xmlparser)>>
  
- == Setting XMLResponseParser ==
- SolrJ uses a binary format as the default format now. For users with Solr 1.2 or older versions
of Solr 1.3 must explicitly ask SolrJ to use XML format.
  
- {{{
- server.setParser(new XMLResponseParser());
- }}}
  == Changing other Connection Settings ==
  !CommonsHttpSolrServer allows setting connection properties.
  
@@ -43, +94 @@

    // 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)>>
  
@@ -145, +197 @@

    UpdateResponse rsp = req.process( server );
  }}}
  === Streaming documents for an update ===
- <!> [[Solr1.4]]
  
- In most cases [[http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.html|StreamingUpdateSolrServer]]
will suit your needs. Alternatively or in case you're using a version prior to 1.4, the workaround
presented below can be applied.
+ In most cases [[http://lucene.apache.org/solr/api/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.html|StreamingUpdateSolrServer]]
will suit your needs. Alternatively, the workaround presented below can be applied.
  
  This is the most optimal way of updating all your docs in one http request.
  
@@ -225, +276 @@

  /!\ Note --  Reuse the instance of !SolrServer if you are using this feature (for performance
)
  
  == Setting the RequestWriter ==
+ 
- <!> [[Solr1.4]] SolrJ lets you upload content in XML and Binary format. Default is
set to be XML.  Use the following to upload using Binary format. This is the same format which
SolrJ uses to fetch results, and can greatly improve performance as it reduces XML marshalling
overhead.
+ SolrJ lets you upload content in XML and Binary format. The default is set to be XML.  Use
the following to upload using Binary format. This is the same format which SolrJ uses to fetch
results, and can greatly improve performance as it reduces XML marshalling overhead.
  
  {{{
      server.setRequestWriter(new BinaryRequestWriter());
@@ -307, +359 @@

        }
      }
  }}}
- = Setting the classpath =
- == Ant ==
- === Solr 1.4 ===
- SolrJ is a part of the 1.4 release. The jars required in the classpath for SolrJ are,
  
-  * commons-codec-1.3.jar (*)
-  * commons-fileupload-1.2.1.jar
-  * commons-httpclient-3.1.jar (*)
-   * commons-logging-1.0.4.jar
-  * commons-io-1.4.jar (*)
-  * geronimo-stax-api_1.0_spec-1.0.1.jar (*)
-  * solr-solrj-1.4.0.jar (+)
-  * wstx-asl-3.2.7.jar (*)
-   * stax-api-1.0.1.jar
-  * slf4j-api-1.5.5.jar (*)
-  * slf4j-simple-1.5.5.jar 
- 
- Note that only the jars marked with an asterisk are located in dist/solrj-lib directory
of the Solr 1.4.0 download. solr-solrj-1.4.0.jar can be found in the dist directory.
- 
- '''TODO:''' The three unmarked jars are missing in dist/solrj-lib.
- 
- === Solr 1.3 ===
- SolrJ is a part of the 1.3 release. The jars required in the classpath for SolrJ are,
- 
-  * commons-io-1.3.1.jar
-  * commons-httpclient-3.1.jar
-  * commons-codec-1.3.jar
-  * commons-logging-1.0.4.jar
-  * apache-solr-common-1.3.0.jar
-  * apache-solr-solrj-1.3.0.jar
- 
- The above jars can be found in the dist/solrj-lib directory of the Solr 1.3.0 download.
- 
- === Solr 1.2 ===
- If you are using an Solr 1.2, add the stax jars too. Do not forget to set the [[#xmlparser|XML
parser]]
- 
-  * geronimo-stax-api_1.0_spec-1.0.1.jar
-  * wstx-asl-3.2.7.jar
-  * stax-utils.jar
- 
- == Maven ==
- Solrj is available in the official Maven repository. Add the following dependency to your
pom.xml to use SolrJ
- 
- {{{
-         <dependency>
-                <artifactId>solr-solrj</artifactId>
-                <groupId>org.apache.solr</groupId>
-                <version>1.4.0</version>
-                <type>jar</type>
-                <scope>compile</scope>
-         </dependency>
- }}}
- If you need to use the !EmbeddedSolrServer, you need to add the solr-core dependency too.
- 
- {{{
-         <dependency>
-                <artifactId>solr-core</artifactId>
-                <groupId>org.apache.solr</groupId>
-                <version>1.4.0</version>
-                <type>jar</type>
-                <scope>compile</scope>
-         </dependency>
- }}}
- 
- If you see any exceptions saying NoClassDefFoundError, you will also need to include:
- {{{
-         <dependency>
-             <groupId>org.slf4j</groupId>
-             <artifactId>slf4j-simple</artifactId>
-             <version>1.5.6</version>
-         </dependency> 
- }}}
- 

Mime
View raw message