Note that there are some explanatory texts on larger screens.

plurals
  1. POSphinx/Thinking Sphinx: filtering phrases connected by an OR operator
    primarykey
    data
    text
    <p>I'm working on a search/filter form based on Thinking Sphinx. There I'm having some difficulty querying a particular Sphinx field for some phrases connected by the OR operator.</p> <p>A little bit of background: I'm indexing a field called "keywords", which contains comma-separated keywords, some of which are phrases, while others are single terms. I want to filter for items that contain keyword A OR keyword B OR keyword C.</p> <p>My search yields the wrong result, since phrases don't seem to get taken into account:</p> <pre><code>Media::Set.search "Architecture", :conditions =&gt; {:keywords =&gt; "\"Computer Aided Design\"|Index-Browser|\"Shape Grammar\"" } </code></pre> <p>I tried every combination of enclosing the phrases in single/double quote with/without escaping that I could think of.</p> <p>I also tried to use the Sphinx extended query syntax, like for example so:</p> <pre><code>Media::Set.search 'Architecture @keywords ("Computer Aided Design" | Index-Browser | "Shape Grammar")', :match_mode =&gt; :extended </code></pre> <p>Again, I've experimented with tweaking the syntax in different ways.</p> <p>One by one, the keywords yield the following results:</p> <ul> <li>Computer Aided Design: 1 match</li> <li>Index-Browser: 1 match </li> <li>Shape Grammar: 3 matches</li> </ul> <p>I'd expect the search for the three keywords, joined by the OR operator to yield 5 matches, but I only ever get the one match for "Index-Browser", which happens to be the only single term (no spaces).</p> <p>What am I doing wrong? Or did I misunderstand how the OR operator is supposed to working?</p> <p>Thanks in advance for any pointers,</p> <p>~ Andrea </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload