Adrian Fraiha
2006-Aug-02 21:52 UTC
[Rails] 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! -- Posted via http://www.ruby-forum.com/.
Tom Davies
2006-Aug-02 22:30 UTC
[Rails] Linking to the paginated items from search results.
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 Fraiha <fraiha@charter.net> wrote:> 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! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tom Davies http://atomgiant.com http://gifthat.com
David Balmain
2006-Aug-03 02:10 UTC
[Rails] Linking to the paginated items from search results.
On 8/3/06, Tom Davies <atomgiant@gmail.com> wrote:> 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, > TomHi 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
Tom Davies
2006-Aug-03 19:49 UTC
[Rails] Linking to the paginated items from search results.
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 :) Tom On 8/2/06, David Balmain <dbalmain.ml@gmail.com> wrote:> On 8/3/06, Tom Davies <atomgiant@gmail.com> wrote: > > 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 > > 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 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tom Davies http://atomgiant.com http://gifthat.com
David Balmain
2006-Aug-04 01:52 UTC
[Rails] Linking to the paginated items from search results.
On 8/4/06, Tom Davies <atomgiant@gmail.com> wrote:> 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 :) > > TomThanks Tom. I understand perfectly.