Thinking Sphinx since v3.0.0 uses Sphinx's SphinxQL protocol (which is very 
similar to SQL), and SphinxQL uses Sphinx's extended match mode, which is 
documented here:
http://sphinxsearch.com/docs/manual-2.1.8.html#extended-syntax

The OR logic is represented in Sphinx with a pipe character |. So, you'll need 
to split up each word by pipes, perhaps like the following:

  params[:search].gsub(/\s+/, ' | ')

Of course, more complex queries may not play nicely with this, so it may be 
easier to teach the people using your site to use pipes, or something that's 
easily regex'd (like OR):

  params[:search].gsub(/\bOR\b/, ' | ')

Cheers

-- 
Pat

On 16 Aug 2014, at 12:06 am, [email protected] wrote:

> How can I search for multiple keywords that will returns results containing 
> at least one of the keywords entered?
>  
> For example on my app there are 2 users who on their profile has "dogs and 
> cat" and "cat" on their page. If I do a search "dogs, cat" it will not return 
> results for both users.
>  
> If I do a search for "cat" it will return both users. The params are 
> "&search=dogs%2C+cat"
>  
> Is there a way so that when a user enters more than one keyword (it could be 
> up to 5), that ThinkingSphinx will return results that contain at least one 
> of those keywords?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to