SebastianJ wrote:
> I'd like to loop through all the pages and collect all the items per
> page into an array that holds all matching entries. I looked at the
> source for the collection (http://github.com/freelancing-god/thinking-
> sphinx/blob/cd9cf7bd1dea7b097b8e7236ca5617f68dc0ab49/lib/
> thinking_sphinx/collection.rb) class but I can't figure out how to do
> this...

You shouldn't need anything in the collection class to achieve this.

You can either just increase the :per_page option (to say, 1000), or if
that doesn't float your boat, you could roll your own loop.

An untested attempt:

  @entities = (1..100).map { |page| 
    classified_entity.search(query, :page => page)
  }.flatten

-- James Healy <jimmy-at-deefa-dot-com>  Tue, 26 May 2009 15:05:32 +1000

--~--~---------~--~----~------------~-------~--~----~
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