Mailing List Archive

solr ruby code update
I've been re-writing/factoring the solr ruby gem -- and the source code can
be found here:

http://github.com/mwmitchell/solr/tree/master

The current version is 0.5.1 and can be installed by running:

gem sources -a http://gems.github.com
sudo gem install mwmitchell-solr

More docs coming, but for the nitty gritty, have a look at some of the tests
if needed.

If you use solr-ruby at all, please have a look. I would love to hear from
some of the ruby folks out there!

Cheers,

Matt
Re: solr ruby code update [ In reply to ]
wow, at first glance this looks spectacular, Matt! one of these
dreamy days i'll carve out time to really play... maybe sooner if you
keep dazzling us like this.


On Dec 16, 2008, at 11:52 PM, Matt Mitchell wrote:

> I've been re-writing/factoring the solr ruby gem -- and the source
> code can
> be found here:
>
> http://github.com/mwmitchell/solr/tree/master
>
> The current version is 0.5.1 and can be installed by running:
>
> gem sources -a http://gems.github.com
> sudo gem install mwmitchell-solr
>
> More docs coming, but for the nitty gritty, have a look at some of
> the tests
> if needed.
>
> If you use solr-ruby at all, please have a look. I would love to
> hear from
> some of the ruby folks out there!
>
> Cheers,
>
> Matt
Re: solr ruby code update [ In reply to ]
tell us more about the willpaginate stuff. your example:

<%= will_paginate(@response) %>

does this paginate a live cursor through solr by requesting start/row
windows? or is it paginating through the docs returned to the
client? shouldn't you paginate an @query or an @request than the
response?

Erik


On Dec 16, 2008, at 11:52 PM, Matt Mitchell wrote:

> I've been re-writing/factoring the solr ruby gem -- and the source
> code can
> be found here:
>
> http://github.com/mwmitchell/solr/tree/master
>
> The current version is 0.5.1 and can be installed by running:
>
> gem sources -a http://gems.github.com
> sudo gem install mwmitchell-solr
>
> More docs coming, but for the nitty gritty, have a look at some of
> the tests
> if needed.
>
> If you use solr-ruby at all, please have a look. I would love to
> hear from
> some of the ruby folks out there!
>
> Cheers,
>
> Matt
Re: solr ruby code update [ In reply to ]
one concept i think we can remove from next gen solr-ruby's....
autocommit. the solr side can handle that configuration, and it's
often not really even a good idea to commit until your job is done, as
we now have rollback features and solr really should be able to handle
lots of uncommitted docs.

thoughts? maybe i'm wrong and having a client api sending commits
periodically in a big batch is warranted.

Erik


On Dec 16, 2008, at 11:52 PM, Matt Mitchell wrote:

> I've been re-writing/factoring the solr ruby gem -- and the source
> code can
> be found here:
>
> http://github.com/mwmitchell/solr/tree/master
>
> The current version is 0.5.1 and can be installed by running:
>
> gem sources -a http://gems.github.com
> sudo gem install mwmitchell-solr
>
> More docs coming, but for the nitty gritty, have a look at some of
> the tests
> if needed.
>
> If you use solr-ruby at all, please have a look. I would love to
> hear from
> some of the ruby folks out there!
>
> Cheers,
>
> Matt
Re: solr ruby code update [ In reply to ]
Erik,

I'm glad you like it so far, definitely some things to work out still but
I'm feeling pretty happy with it.

The pagination is real, not just a huge doc set using array cursors. The
library is converting :page and :per_page to "rows" and "start. You use it
by first querying, using the :page and :per_page params like:

result = solr.query(:page=>1, :per_page=>10, :q=>'*:*')
# or "search"
result = solr.search('ipod', :page=>1, :per_page=>10)

The result object now has methods that WillPaginate can hook into, namely:
current_page, total_pages, next_page and previous_page. With those methods,
the will_paginate view helper can create the pagination view widget. Of
course, the :page param would probably be dynamic; in Rails/Merb --
params[:page].

But you bring up a good point about where the pagination should be
"happening". Maybe instead of paginating the top-level "result", it'd be
more intuitive to do it on just a document set like:

result = solr.query(:page=>1, :per_page=>10, :q=>'*:*')
@docs = result.documents

<%= will_paginate(@docs) %>

What do you think?

Thanks for having a look and please do play with it when you get a chance!

Matt

On Wed, Dec 17, 2008 at 12:12 AM, Erik Hatcher
<erik@ehatchersolutions.com>wrote:

> tell us more about the willpaginate stuff. your example:
>
> <%= will_paginate(@response) %>
>
> does this paginate a live cursor through solr by requesting start/row
> windows? or is it paginating through the docs returned to the client?
> shouldn't you paginate an @query or an @request than the response?
>
> Erik
>
>
> On Dec 16, 2008, at 11:52 PM, Matt Mitchell wrote:
>
> I've been re-writing/factoring the solr ruby gem -- and the source code
>> can
>> be found here:
>>
>> http://github.com/mwmitchell/solr/tree/master
>>
>> The current version is 0.5.1 and can be installed by running:
>>
>> gem sources -a http://gems.github.com
>> sudo gem install mwmitchell-solr
>>
>> More docs coming, but for the nitty gritty, have a look at some of the
>> tests
>> if needed.
>>
>> If you use solr-ruby at all, please have a look. I would love to hear from
>> some of the ruby folks out there!
>>
>> Cheers,
>>
>> Matt
>>
>
>
Re: solr ruby code update [ In reply to ]
On Dec 17, 2008, at 8:39 AM, Matt Mitchell wrote:
> The result object now has methods that WillPaginate can hook into,
> namely:
> current_page, total_pages, next_page and previous_page. With those
> methods,
> the will_paginate view helper can create the pagination view widget.

Gotcha, so WillPaginate makes it nicer to generate paging controls,
but isn't itself cursoring through Solr. it provides parameters that
are used elsewhere in another action. Got it (I think).

I was thinking WillPaginate was maybe doing something like
Solr::Importer::SolrSource - but I was confused.

> <%= will_paginate(@docs) %>

Nah, I think @response is better now that I think about it. You'll
want the current start/rows back from Solr in the response. @docs
won't give you that, right?

Erik
Re: solr ruby code update [ In reply to ]
There have been lots of updates on this. More tests and features! And yes,
:auto_commit is gone :)

github url:

http://github.com/mwmitchell/solr/tree/master

Matt