M
M
Maxim Grechushnikov2015-10-04 13:06:07
Sphinx
Maxim Grechushnikov, 2015-10-04 13:06:07

Sphinx: How to make a query correctly?

There was a problem with the site. The variable is not escaped.
'@name "' . $value . '"';
If you submit to value = 1" then an error will pop up

SELECT 
     COUNT(*) as `count`, 
     @groupby, IF(cetime > 1443953076, IF(cprice > 0, 2, 1), 0) AS ck 
FROM 
     aa_index 
WHERE 
    activity_id = 298 
    AND MATCH('@name "1""') 
GROUP BY company 
ORDER BY 
     ck DESC, 
     cprice DESC 
LIMIT 
     0, 100000 
OPTION 
     max_matches = 100000

index aa_index_delta,aa_index_main: syntax error, unexpected $end near ''

How to properly escape a variable (real_escape_string deprecated) so that the search is by 1" or where to correct something in the index so that the quotes are indexed correctly.
P.s. It is important for the customer to search by 1"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2015-10-07
@Panda_Tamara

Can't check, but escaping with a backslash might help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question