anonymous user

Forums   Register   Login   Forgot your login/password?   Search

index xxxxxxx: syntax error, unexpected '$' near '$"/1'

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 526 | 527 | 528 | 529 | next »» | Create new thread

riddla604

Name: TP
Posts: 5

2010-03-07 12:35:52 | reply!


php extension + sphinx 0.9.9:

i am receiving this when running queries with "$" in them.

i understand that this is a reserved character, but the strange thing is i am escaping
via:

$result=$sph->Query($sph->escapeString($search),SPHINXTABLE);

am i correct to assume that ->escapeString should in fact escape "$"?

barryhunter

Name: Barry Hunter
Posts: 7499

to: riddla604, 2010-03-08 00:09:03 | reply!


What is the full query you trying to run.

If $ should be escaped depends on if you want it to be part of the query syntax or part
of a word.

Ie do you have $ in your charset_table?


You probably ok calling escapeString blindly on a simple query that just a few keywords.

But if you using the extended query syntax (or accepting it from the user) then it will
probably escapeString will break it.

Its meant to be called on the keywords themselves, not after you constructed it into a
full query.

riddla604

Name: TP
Posts: 5

to: barryhunter, 2010-03-08 11:42:41 | reply!


heya berry, first and foremost, thanks for the reply.

the query is for sure a long, multi-word query.

i don't have the exact query recorded, but its basically for 'related videos' according
to title. so in essence the same idea as if a member were to type it in.

i think the wisest thing would be for me to just manually escape the query, since i am
only seeing this in my logs for "$". i do a bunch of filtering for video titles, but $ is
a character i would like to keep as 'allowed'.

so,

what is the escape character in sphinx? your standard "\"?

thanks!

> What is the full query you trying to run.
>
> If $ should be escaped depends on if you want it to be part of the query syntax or part
> of a word.
>
> Ie do you have $ in your charset_table?
>
>
> You probably ok calling escapeString blindly on a simple query that just a few keywords.
>
> But if you using the extended query syntax (or accepting it from the user) then it will
> probably escapeString will break it.
>
> Its meant to be called on the keywords themselves, not after you constructed it into a
> full query.

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 526 | 527 | 528 | 529 | next »» | Create new thread