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
>>
>
>