Linking to the paginated items from search results

Using Ferret for searching, I’ve got results that I need to link to.
Which is fine, except for that they’re displayed on paginated pages
using Rails paginate function - so it’s not like I can’t get it from the
database or anything else. Anyone have any ideas on how to go about
this? It’s not so much a coding problem as a theory problem, and I can’t
even think of how to begin. Thanks in advance!

I think there are really only two options:

  1. Store the search results in the session.

  2. Use ferret’s :num_docs and :first_doc to paginate the results for
    each page. NOTE: These options are going to change to :limit and
    :offset to be more railish in a future ferret release.

I am currently doing option 2 on my site. However, I asked a similar
question to this group a while back and one of the interesting points
someone made was that when you search through results it can be
annoying if they shift around, so in that case option 1 would be
preferred.

Good Luck,
Tom

On 8/2/06, Adrian F. [email protected] wrote:

Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://atomgiant.com
http://gifthat.com

On 8/3/06, Tom D. [email protected] wrote:

someone made was that when you search through results it can be
annoying if they shift around, so in that case option 1 would be
preferred.

Good Luck,
Tom

Hi Tom,

Just curious. What do you mean when you say the results shift around?
Is this something I need to fix in Ferret?

Cheers,
Dave

Hi Dave,

Actually, I meant if you rerun the query between page requests and the
index changes then your search results may legitimately be different.

For example if someone is sorting on created_at DESC and any entries
get added in between pages then some of thre results that were just
show on say page 1 will now be in page 2 since those new entries will
be returned as well.

If that doesn’t make sense, let me know and I’ll try again. For some
reason I found it very difficult to type that out in words :slight_smile:

Tom

On 8/2/06, David B. [email protected] wrote:

question to this group a while back and one of the interesting points
Is this something I need to fix in Ferret?

Cheers,
Dave


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Tom D.

http://atomgiant.com
http://gifthat.com

On 8/4/06, Tom D. [email protected] wrote:

If that doesn’t make sense, let me know and I’ll try again. For some
reason I found it very difficult to type that out in words :slight_smile:

Tom

Thanks Tom. I understand perfectly.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs