using and and or in search

jonasholstein's Avatar


09 Oct, 2013 07:08 PM

Is it possible to set some option, so that I can use "or" and "and" in my search instead of "|" and "&"?

  1. Support Staff 1 Posted by Pat Allan on 10 Oct, 2013 12:11 AM

    Pat Allan's Avatar

    Hi Jonas

    I'm afraid Sphinx doesn't have any settings for that… you'll need to gsub through your search queries to make those changes yourself. I've done it before in an app I've helped develop (insisting on AND and OR in uppercase):

        params[:query].gsub(/\s+OR\s+/, ' | ').gsub(/\s+AND\s+/, ' ')

    ANDs are implicit in Sphinx, so you don't actually need to change it to &.

    Hope this helps.


  2. 2 Posted by jonasholstein on 16 Oct, 2013 12:27 PM

    jonasholstein's Avatar

    Thanks Pat :-)

  3. Pat Allan closed this discussion on 13 Jan, 2014 11:18 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac