[ 
https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646459#action_12646459
 ] 

mwmitchell edited comment on SOLR-826 at 11/10/08 7:56 PM:
--------------------------------------------------------------

Added exception handling when querying or updating.
  - parses solr html response errors when using http connection

Return a Solr::Response::* if :wt == :ruby
Return a raw response (String) if :wt != :ruby
Can set default_:wt in Solr::Server
Can set :auto_commit in Solr::Server
Added xml escaping to values and attributes


Examples:

connection = Solr::Connection::HTTP.new

- if running under jRuby, could also do:
- connection = Solr::Connection::Direct.new('/solr-home/path')

solr = Solr::Server.new(connection, {:default_wt=>:ruby, :auto_commit=>true})

r = solr.add :id=>1, :sku=>'L009'
r.class == Solr::Response::Update
puts r.query_time

-  raises exception (duplicate docs with same :id) - only works with HTTP 
connection
r = solr.add :id=>1, :sku=>'L009'

r = solr.query :q=>'*:*'
r.class == Solr::Response::Query

- raises exception (invalid syntax)
r = solr.query :q=>':'

r = solr.query :q=>'*:*', :wt=>:xml
r.class == String
h = Hpricot(r)

r = solr.query :q=>'*:*', :wt=>:json
r.class == String
j = JSON.parse(r)

Main modules/classes:

Solr
Solr::XML < Xout (xml generator)
Solr::Server
Solr::Connection::HTTP
Solr::Connection::Direct
Solr::Connection::URLHelpers
Solr::Response::Base
Solr::Response::Query
Solr::Response::Update

      was (Author: mwmitchell):
    Added exception handling when querying or updating.
  * parses solr html response errors when using http connection
Return a Solr::Response::* if :wt == :ruby
Return a raw response (String) if :wt != :ruby
Can set default_:wt in Solr::Server
Can set :auto_commit in Solr::Server
Added xml escaping to values and attributes


Examples:

connection = Solr::Connection::HTTP.new

# if running under jRuby, could also do:
# connection = Solr::Connection::Direct.new('/solr-home/path')

solr = Solr::Server.new(connection, {:default_wt=>:ruby, :auto_commit=>true})

r = solr.add :id=>1, :sku=>'L009'
r.class == Solr::Response::Update
puts r.query_time

# raises exception (duplicate docs with same :id) - only works with HTTP 
connection
r = solr.add :id=>1, :sku=>'L009'

r = solr.query :q=>'*:*'
r.class == Solr::Response::Query

# raises exception (invalid syntax)
r = solr.query :q=>':'

r = solr.query :q=>'*:*', :wt=>:xml
r.class == String
h = Hpricot(r)

r = solr.query :q=>'*:*', :wt=>:json
r.class == String
j = JSON.parse(r)

Main modules/classes:

Solr
Solr::XML < Xout (xml generator)
Solr::Server
Solr::Connection::HTTP
Solr::Connection::Direct
Solr::Connection::URLHelpers
Solr::Response::Base
Solr::Response::Query
Solr::Response::Update
  
> For the solr-ruby-refactoring movement
> --------------------------------------
>
>                 Key: SOLR-826
>                 URL: https://issues.apache.org/jira/browse/SOLR-826
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - ruby - flare
>            Reporter: Matt Mitchell
>         Attachments: experiments.2.patch, experiments.3.patch, 
> experiments.4.patch, experiments.patch
>
>
> This is a patch to add a new directory to the solr-ruby-refactoring "branch". 
> It's a very lightweight blob of code for connecting, selecting, updating and 
> deleting using Ruby. It requires the URI and Net::HTTP libraries. No tests at 
> the moment but I think the comments will do for now.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to