Adjust README with current API

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@496211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2007-01-15 02:43:02 +00:00
parent dea9c9d291
commit 3fefa3f9f1
1 changed files with 16 additions and 13 deletions

View File

@ -1,42 +1,45 @@
solrb exposes the power of Solr as a Ruby DSL (domain specific language).
Visit the Solr Flare wiki for more information: http://wiki.apache.org/solr/Flare
Visit the solrb wiki for more information: http://wiki.apache.org/solr/solrb
USAGE
First launch Solr.
In a separate shell, launch script/console.
cd solr
java -jar start.jar
In a separate shell, launch irb -Ilib.
# Bring in the Solr library
require 'solr'
# Set up a connection to Solr:
connection = Solr::Connection.new("http://localhost:8983")
connection = Solr::Connection.new 'http://localhost:8983/solr'
# To add a document:
doc = {:id => "529", :text => "Solr Flare in Action"}
request = Solr::AddDocumentRequest.new(doc)
doc = Solr::Document.new :id => '529', :text => 'Solr Flare in Action'
request = Solr::Request::AddDocument.new(doc)
connection.send(request)
# Commit changes:
request = Solr::UpdateRequest.new("<commit/>") # TODO: yes, this will be mapped as a simpler command!
connection.send(request)
connection.commit
# Search:
request = Solr::StandardRequest.new
request.query = "solr flare"
request = Solr::Request::Standard.new :query => 'solr flare'
connection.send(request)
INSTALLATION
First run the tests:
rake test
rake
then build the gem:
rake package