I am trying to use NEAR operator with two sentences - which means I need to 
use double quotes for each sentence. I've tried multiple ways trying to get 
it to work without luck.


1.
q = '"law" NEAR/1 "by law"'
Frame::Decision.search(q).count

Output: Sphinx Query (1.5ms)  SELECT * FROM `frame_decision_core` WHERE 
MATCH('\"law\" NEAR/1 \"by law\"') AND `sphinx_deleted` = 0 LIMIT 0, 20

2.
q = %q("law" NEAR/1 "by law")
Frame::Decision.search(Riddle::Query.escape(q)).count

Output:  Sphinx Query (1.1ms)  SELECT * FROM `frame_decision_core` WHERE 
MATCH('\\\"law\\\" NEAR\\/1 \\\"by law\\\"') AND `sphinx_deleted` = 0 LIMIT 
0, 20

3.
q = '"law" NEAR/1 "by law"'
Frame::Decision.search(q).count

Output: Sphinx Query (1.3ms)  SELECT * FROM `frame_decision_core` WHERE 
MATCH('\"law\" NEAR/1 \"by law\"') AND `sphinx_deleted` = 0 LIMIT 0, 20



My guess is that using double quotes results in escape back slashes which 
breaks things. The output probably has to look like this: MATCH('"law" 
NEAR/1 "by law"')

-- 
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 https://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to