2007-01-02 23:57:00 -05:00
|
|
|
solrb exposes the power of Solr as a Ruby DSL (domain specific language).
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
Visit the solrb wiki for more information: http://wiki.apache.org/solr/solrb
|
2007-01-02 23:57:00 -05:00
|
|
|
|
|
|
|
USAGE
|
|
|
|
|
|
|
|
First launch Solr.
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
cd solr
|
|
|
|
java -jar start.jar
|
|
|
|
|
|
|
|
In a separate shell, launch irb -Ilib.
|
|
|
|
|
|
|
|
# Bring in the Solr library
|
|
|
|
require 'solr'
|
2007-01-02 23:57:00 -05:00
|
|
|
|
|
|
|
# Set up a connection to Solr:
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
connection = Solr::Connection.new 'http://localhost:8983/solr'
|
2007-01-02 23:57:00 -05:00
|
|
|
|
|
|
|
# To add a document:
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
doc = Solr::Document.new :id => '529', :text => 'Solr Flare in Action'
|
|
|
|
request = Solr::Request::AddDocument.new(doc)
|
2007-01-02 23:57:00 -05:00
|
|
|
connection.send(request)
|
2007-01-14 21:43:02 -05:00
|
|
|
|
2007-01-02 23:57:00 -05:00
|
|
|
# Commit changes:
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
connection.commit
|
2007-01-02 23:57:00 -05:00
|
|
|
|
|
|
|
# Search:
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
request = Solr::Request::Standard.new :query => 'solr flare'
|
2007-01-02 23:57:00 -05:00
|
|
|
connection.send(request)
|
|
|
|
|
|
|
|
|
|
|
|
INSTALLATION
|
|
|
|
|
|
|
|
First run the tests:
|
|
|
|
|
2007-01-14 21:43:02 -05:00
|
|
|
rake
|
|
|
|
|
2007-01-02 23:57:00 -05:00
|
|
|
then build the gem:
|
|
|
|
|
|
|
|
rake package
|
|
|
|
|
|
|
|
and install the versioned gem:
|
|
|
|
|
|
|
|
gem install pkg/solr-x.x.x.gem
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This package is licensed using the Apache Software License 2.0.
|
|
|
|
|
|
|
|
<http://www.apache.org/licenses/LICENSE-2.0>
|