You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Matt Mitchell (JIRA)" <ji...@apache.org> on 2008/10/28 05:54:44 UTC
[jira] Created: (SOLR-826) For the solr-ruby-refactoring movement
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
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.
[jira] Issue Comment Edited: (SOLR-826) For the
solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Mitchell updated SOLR-826:
-------------------------------
Attachment: experiments.patch
> 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.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.
[jira] Updated: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Mitchell updated SOLR-826:
-------------------------------
Attachment: experiments.4.patch
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.
[jira] Commented: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646164#action_12646164 ]
Matt Mitchell commented on SOLR-826:
------------------------------------
Just to make it clear, the comment above was just me thinking (no code here to support it)... We can get to the fancy higher level API stuff with add-on modules down the road.
> 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.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.
[jira] Updated: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Mitchell updated SOLR-826:
-------------------------------
Attachment: experiments.3.patch
Here is a version that supports http (standard ruby) and jruby (direct connection) within the same interface. I'm trying my best to keep things as simple as possible and staying away from extra dependencies.
I'm wondering, do we really need to support other response formats? If you decide to set the wt to xml, then returning the raw xml should be good enough right? What if someone wants to use Hpricot? What about REXML? If it's raw, then you could use whatever you'd like. It might be better to let people decide on how they'd like to handle alternate response formats? Thoughts?
> 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.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.
[jira] Commented: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644305#action_12644305 ]
Matt Mitchell commented on SOLR-826:
------------------------------------
Thoughts on an interface like this? Similar to what's there now I suppose, except for the add part.
+ add a single doc
solr.add :product_name=>'Waffle Pro II'
+ add a single doc with doc options (most common use probably)
solr.add {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
+ add multiple docs, with add options, doc options and field options
solr.add(:allowDups=>false, :commitWithin=>10) do |add|
add.doc :product_name=>'Waffle Pro II'
add.doc {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
add.doc(:boost=>10) do |doc|
doc.field :product_name, 'Waffle Basic'
doc.field :description, 'The fastest way to get from here to there', :boost=>10.0
end
end
+ delete by id
solr.delete_by_id 1
+ delete multiples by id
solr.delete_by_id 1, 2, 3, 4
+ delete by query
solr.delete_by_query 'quantity:0'
+ delete multiples by query
solr.delete_by_query 'quantity:0', 'available:false'
> 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.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.
[jira] Updated: (SOLR-826) For the solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Mitchell updated SOLR-826:
-------------------------------
Attachment: experiments.2.patch
This is even more stripped down. A basic connection with get/post methods. Keeping it simple like this would provide the possibility of mixing in different modules for higher-level methods like add, delete_by_id etc..
> 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.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.
[jira] Issue Comment Edited: (SOLR-826) For the
solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644305#action_12644305 ]
mwmitchell edited comment on SOLR-826 at 10/31/08 7:37 AM:
--------------------------------------------------------------
Thoughts on an interface like this? Similar to what's there now I suppose, except for the add part.
{code:ruby}
# add a single doc
solr.add :product_name=>'Waffle Pro II'
# add a single doc with doc options (most common use probably)
solr.add {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
# add multiple docs, with add options, doc options and field options
solr.add(:allowDups=>false, :commitWithin=>10) do |add|
add.doc :product_name=>'Waffle Pro II'
add.doc {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
add.doc(:boost=>10) do |doc|
doc.field :product_name, 'Waffle Basic'
doc.field :description, 'The fastest way to get from here to there', :boost=>10.0
end
end
# delete by id
solr.delete_by_id 1
# delete multiples by id
solr.delete_by_id 1, 2, 3, 4
# delete by query
solr.delete_by_query 'quantity:0'
# delete multiples by query
solr.delete_by_query 'quantity:0', 'available:false'{code}
was (Author: mwmitchell):
Thoughts on an interface like this? Similar to what's there now I suppose, except for the add part.
+ add a single doc
solr.add :product_name=>'Waffle Pro II'
+ add a single doc with doc options (most common use probably)
solr.add {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
+ add multiple docs, with add options, doc options and field options
solr.add(:allowDups=>false, :commitWithin=>10) do |add|
add.doc :product_name=>'Waffle Pro II'
add.doc {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
add.doc(:boost=>10) do |doc|
doc.field :product_name, 'Waffle Basic'
doc.field :description, 'The fastest way to get from here to there', :boost=>10.0
end
end
+ delete by id
solr.delete_by_id 1
+ delete multiples by id
solr.delete_by_id 1, 2, 3, 4
+ delete by query
solr.delete_by_query 'quantity:0'
+ delete multiples by query
solr.delete_by_query 'quantity:0', 'available:false'
> 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.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.
[jira] Issue Comment Edited: (SOLR-826) For the
solr-ruby-refactoring movement
Posted by "Matt Mitchell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SOLR-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644305#action_12644305 ]
mwmitchell edited comment on SOLR-826 at 10/31/08 7:38 AM:
--------------------------------------------------------------
Thoughts on an interface like this? Similar to what's there now I suppose, except for the add part.
{code:java}
# add a single doc
solr.add :product_name=>'Waffle Pro II'
# add a single doc with doc options (most common use probably)
solr.add {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
# add multiple docs, with add options, doc options and field options
solr.add(:allowDups=>false, :commitWithin=>10) do |add|
add.doc :product_name=>'Waffle Pro II'
add.doc {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
add.doc(:boost=>10) do |doc|
doc.field :product_name, 'Waffle Basic'
doc.field :description, 'The fastest way to get from here to there', :boost=>10.0
end
end
# delete by id
solr.delete_by_id 1
# delete multiples by id
solr.delete_by_id 1, 2, 3, 4
# delete by query
solr.delete_by_query 'quantity:0'
# delete multiples by query
solr.delete_by_query 'quantity:0', 'available:false'{code}
was (Author: mwmitchell):
Thoughts on an interface like this? Similar to what's there now I suppose, except for the add part.
{code:ruby}
# add a single doc
solr.add :product_name=>'Waffle Pro II'
# add a single doc with doc options (most common use probably)
solr.add {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
# add multiple docs, with add options, doc options and field options
solr.add(:allowDups=>false, :commitWithin=>10) do |add|
add.doc :product_name=>'Waffle Pro II'
add.doc {:product_name=>'Waffle Semi-Pro'}, :boost=>1.5
add.doc(:boost=>10) do |doc|
doc.field :product_name, 'Waffle Basic'
doc.field :description, 'The fastest way to get from here to there', :boost=>10.0
end
end
# delete by id
solr.delete_by_id 1
# delete multiples by id
solr.delete_by_id 1, 2, 3, 4
# delete by query
solr.delete_by_query 'quantity:0'
# delete multiples by query
solr.delete_by_query 'quantity:0', 'available:false'{code}
> 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.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.