Closed gregwinn closed 12 years ago
Hi Greg
It depends - what is the expected behaviour when there's more than one search term? Do you want records that match all terms? Or any?
Pat
On 27/10/2011, at 9:11 PM, Greg Winn wrote:
Hello, I am working on a project that requires many search "terms" in one search so something like this:
search_terms = ["Term One", "Term2", "Another Term"] Post.search search_terms
Is this possible and if not is there a better way to do this?
Thank you very much for any help!
Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/298
Hey Pat, Any of the phrases given.
Thanks for the reply!!
Hi Greg
That makes things a little tricky - you're going to have to do something like this: terms = ['alpha', 'beta gamma', 'delta'] Post.search "\"#{terms.join('" | "')}\"", :match_mode => :extended
This keeps each term together (instead of breaking them up into separate words), and inserts the OR separator between each one. The extended match mode is required for both quotes and OR pipes to work.
Give that a shot, let me know how you go.
Cheers
Pat
On 28/10/2011, at 7:10 PM, Greg Winn wrote:
Hey Pat, Any of the phrases given.
Thanks for the reply!!
Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/298#issuecomment-2559272
Pat, Thank you very much! This did work!
Thank you very much!!!! Greg
Hello, I am working on a project that requires many search "terms" in one search so something like this:
Is this possible and if not is there a better way to do this?
Thank you very much for any help!