Other plausible solution is overriding the default :per_page value,
but this doesn't look very clean to me. Does anybody know a better
way of iterating through all search results?
I hope I made my question clear.
--
Murilo Soares Pereira
http://www.comp.ufscar.br/~murilo
There isn't any way to do this with Thinking Sphinx... your best bet is to override :per_page.
I guess as an alternative is to add a helper method that does each page - perhaps the following code does the job (I've not tested it):
def all_results_each(query, options = {}, &block)
search = ThinkingSphinx.search query, options
loop do
search.each do |match|
yield match
end
search = ThinkingSphinx.search query, options.merge(:page => search.next_page)
break unless search.next_page
end
end
Hope this helps.
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>
>
Thank you very much for this piece of code, i'll plug it in right
away.
Kind regards.
--
Murilo Soares Pereira
http://www.comp.ufscar.br/~murilo