solr-ruby

Features

Our working task list: solr-ruby/ToDo

Trying out solr-ruby

  require 'solr'

  # connect to the solr instance
  conn = Solr::Connection.new('http://localhost:8983/solr', :autocommit => :on)

  # add a document to the index
  conn.add(:id => 123, :title_text => 'Lucene in Action')

  # update the document
  conn.update(:id => 123, :title_text => 'Solr in Action')

  # print out the first hit in a query for 'action'
  response = conn.query('action')
  print response.hits[0]

  # iterate through all the hits for 'action'
  conn.query('action') do |hit|
    puts hit.inspect
  end

  # delete document by id
  conn.delete(123)

Future Development Plan

We're solr-ruby/BrainStorming DSL ideas. Join us, please.

last edited 2007-06-16 06:15:36 by ThiagoJackiw