Pat Allan on 20 Mar, 2018 12:37 PM
It is indeed possible to send two search queries in a single call to Sphinx. Presuming you're using TS v3, this syntax should do the trick:
batch = ThinkingSphinx::BatchedSearch.new
batch.searches << Model.search("foo")
batch.searches << Model.search("bar")
batch.searches.each do |search|
Keep in mind that if you're testing this in a Rails console, the inspection of a search results set populates the data immediately, which would make this fail. An easy way around this is to add ; "" at the end of lines that involve search calls. e.g.:
batch.searches << Model.search("foo"); ""
All of that said… if you need the values from the first search to be used in the second, I'm afraid that's not possible in Sphinx.