jruby_streaming_update_solr_server¶ ↑
Some syntactic sugar on top of the StreamingUpdateSolrServer as provided by the Apache Solr project, along with its most common argument, the SolrInputDocument.
Documentation can be generated with yard via the ‘rake yard’ action and available online at rdoc.info/projects/billdueber/jruby_streaming_update_solr_server
See the class files for more information, documentation, and examples.
Quick example¶ ↑
# @example Create and add a SolrInputDocument # url = 'http://solrmachine:port/solr' # URL to solr # queuesize = 10 # Size of producer cache # threads = 2 # Number of consumer threads to push docs from queue to solr # # suss = StreamingUpdateSolrServer.new(url,queuesize,threads) # # # Explicitly pick to send javabin or XML. The former requires the line # # <requestHandler name="/update/javabin" class="solr.BinaryUpdateRequestHandler" /> # # in you solrconfig.xml # # suss.useJavabin! # # or suss.useXML! to get back to the default # # doc = SolrInputDocument.new # doc.add 'title', 'This is the title' # doc << ['title', "This is yet another title, added with '<<'"] # doc.add 'id', 1 # doc.add 'author', ['Mike', 'Bill', 'Molly'] # adds multiple values at once # suss.add doc # or suss << doc # # repeat as desired # suss.commit # # @example Create and add as a hash # # The "hash" just needs to be an object that responds to each_pair with field,value(s) pairs # suss = StreamingUpdateSolrServer.new(url,queuesize,threads) # hash = {} # hash['title'] = This is the title' # hash['author'] = ['Bill', 'Mike'] # Note that we can add multiple values at once # suss << hash # # repeat as desired # suss.commit
What is this again?¶ ↑
For users of Solr, there is a java class called StreamingUpdateSolrServer that allows you to easily (and in a threaded manner) add documents (of class SolrInputDocument) to a queue and have them automatically sent along to Solr by a user-configurable number of threads.
These classes open up those Java classes to add some JRuby sugar and make it easy for you to construct Solr documents and send them to Solr all from within the comfort of the JRuby environment.
Note that you can use threach to multi-thread it all.
ToDo¶ ↑
-
Figure out why the http client hangs on for so long
-
More complete examples
CHANGES¶ ↑
0.6.0
-
Changed SolrInputDocument#add to ignore values that are the empty string in addition to nil
0.5.2
-
More fixes to to_s
0.5.1 (2010.10.05)
-
Changed the #to_s method to be a little easier to deal with
0.5.0 (2010.09.16)
-
Removed a begin/rescue/end block that had been looking for simple argument errors for logging; speedup is tremendous.
-
No longer allow “array-like” in #add; only allow actual Arrays. Again, speedup.
0.4.1 (2010.09.07)
-
Updated documentation
-
Added access to document-level boost via #boost and #boost=
-
Added access to field-level boost via #fieldBoost and #setFieldBoost
-
Added third parameter to ‘#add` for field-level boost
-
Added #values
-
Release new gem
2010.07.09 Added #useJavabin!
Copyright¶ ↑
Copyright © 2010 Bill Dueber. See LICENSE for details.