On 10/17/06, koloa <[EMAIL PROTECTED]> wrote:
>
>
> Hello Jens, just a quick question about your code...
>
> if i am using this:
>
>  @test =
> County.find_by_contents(@params['search_string'],:first_doc=>0,:num_docs=>10)

For starters, :first_doc is now :offset and :num_docs is now :limit,
as of Ferret 0.10.0.

> do i just setup up numbered links in my view to pass a variable to
> first_doc? so if i wanted to get the next set, id do:
>
>
>  @test =
> County.find_by_contents(@params['search_string'],:first_doc=>@params['10'],
> :num_docs=>10)

Strange parameter name but yes, that's how you'd do it.

> if this is the case, is there an easier way and also a way to count how
> many sets or how many pages there are in a table for a given query?
> would i just get a total from the array and then divide by 10 docs?
> etc...?

I'm not sure about easier way but you can get the total number of
matching hits from @test.total_hits. On the other hand, @test.size
will be the number of hits returned.

Hope that answers your question,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to