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 "SolRuby" by ErikHatcher
Date Tue, 02 Jan 2007 10:02:56 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by ErikHatcher:
http://wiki.apache.org/solr/SolRuby

The comment on the change is:
Fleshing out Flare's design goals

------------------------------------------------------------------------------
  
  == Ruby on Rails ==
  There is an [http://acts-as-solr.rubyforge.org/ acts_as_solr] plugin to add full text search
capabilities using Solr to any Rails model
- 
- 
- ---
- 
- In Ruby on Rails, the concept of models can extend beyond a local database.  As SOLR functions
as a web service, it makes sense to have Ruby query the SOLR web service, parse the returned
XML document, and have the data work in the same fashion as a database model would.
- 
- Bindings for integration into Rails: (not finished)
- 
- 
- Erik Hatcher posted the following message on the Solr mailing list for ideas.
- 
- 
- My current code has not been distilled into a clean API, but it's usable.  It all boils
down to this:
- 
- {{{
-    def post_to_solr(body, mode = :search)
-      post = Net::HTTP::Post.new(mode == :search ? "/solr/select" : "/solr/update")
-      post.body = body
-      post.content_type = 'application/x-www-form-urlencoded'
-      response = Net::HTTP.start(@url.host, @url.port) do |http|
-        http.request(post)
-      end
-      response_dom = Document.new(response.body)
-    end
- }}}
- 
- though using REXML's Document is likely to be pulled out to something more optimal for Ruby
ingesting, such as YAML.
- 
- This sits in a Solr class and has utility methods like this:
- 
- {{{
-    def optimize
-      post_to_solr('<optimize waitFlush="false" waitSearcher="false"/  >', :update)
-    end
- }}}
- 
- So I can use IRB (via Rails slick script/console) and do this:
- 
- {{{
- 	solr = Solr.new
- 	results = solr.search([{:field => "year", :value => "1865"}], 0, 20)
- }}}
- 
- I'm tinkering around with various custom request handlers, custom parameters, and faceted
results so nothing has settled down into a stable way to do things just yet, so I haven't
felt the generalization falling into place yet.  I sincerely hope someone Solr/ Lucene/Java
and Ruby savvier than I will eventually step up and build a super slick Solr Ruby DSL :) 
But it needs to be more flexible than just the standard request handler to be of use to me,
so it's more complex than meets the eye.
- 
- 	Erik
  
  ----
  
@@ -102, +56 @@

  
  - Seth
  
+ -------
+ 
+ ["Flare"] promises an elegant Solr Ruby DSL and Rails-based presentation framework.
+ 

Mime
View raw message