I've actually just added this recently - so make sure you're using the latest 
gem (or the latest source as a plugin).

Keep in mind I've built this functionality to help speed up facet queries, so 
not sure how well it fits general use, but hopefully it does the job:

  ThinkingSphinx::Search.bundle_searches(array) do |sphinx, item_in_array|
    sphinx.search "condition_one condition_two"
    sphinx.search "condition_two"
  end

That will return an array of search results... now, I can see that the array 
provided as an argument (and the subsequent yielding of each item) only works 
if you're naturally creating a set of queries from some kind of collection. So 
at this point, you *need* an array with something in it - otherwise, there's 
nothing to loop over, and your inner block won't run.

You *should* be able to call #search on the sphinx object as many times as you 
like, and it will queue up each search (ie: you don't need to call it just once 
per yield).

Anyway, see how you go, and let me know if you get stuck :)

-- 
Pat

On 27/08/2010, at 2:52 PM, madhu wrote:

> dear pat,
> 
> Is there a way to make batch query in TS ?  For example:
> 
> 1) my first query is something like this "condition_one condition_two"
> 2) my second query is something like this "condition_one
> condition_three"
> 
> Please note the  "condition_one" remains the same in both the places.
> These queries are very complex extended queries.
> 
> When i contacted the excellent sphinx support team about performance
> improvement, they suggested me to run it in batch queries.  The PHP
> code is something like this :
> 
> $cl->AddQuery(query1);
> $cl->AddQuery(query2);
> $res = $cl->RunQueries ();
> 
> Is there such an option available in TS ?
> 
> tx
> madhu
> 
> -- 
> 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