Hi 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

On 06/01/2010, at 1:09 PM, Murilo Soares Pereira wrote:

> I did a little search and can't find a solution for this. The best I
> found was 'paginated_each', but it seems to work at class level
> (WillPaginate), so it doesn't work with ThinkingSphinx::Search'es.
> 
> 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
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.


Reply via email to