Skip to main content
Topic: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4) (Read 2524 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Set up Sphinx (2.0.4, Ubuntu 14.04 LTS) on my test forum in sphinxql mode. Seems to be working generally, search from Elkarte doesn't work - in error log I get get this syntax error:

sphinxql: syntax error, unexpected WEIGHT, expecting IDENT (or 11 other tokens) near 'weight() + (relevance/1000)) rank FROM elkarte_index WHERE MATCH('aeroplane') AND id_board IN (1) GROUP BY id_topic WITHIN GROUP ORDER BY rank DESC, poster_time DESC ORDER BY rank DESC, poster_time DESC LIMIT 0,2000 OPTION field_weights=(subject=3000,body=1000)'

I'll try the other method.

Re: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Reply #1

So - it works using phpapi.php method.

Re: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Reply #2

I use the sphinxql interface on 14.04, but its with version Sphinx 2.1.9.  I see 2.2.5 is out so I should try it against that as well.

I left the api version in place along with the QL as the api is generally a stable interface, but whats available or not in the QL interface gets pretty confusing, at least for me.  The api is a good backup plan and you can get in to endless discussions of which is better or not so I'd rather not.

Could you try updating the version you are running as see if that works?

Re: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Reply #3

Sure - to 2.2.5?

Re: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Reply #4

Try Sphinx 2.1.9 first ... that works for me so I want to narrow down if its a Sphinx version incompatibility or a query problem that I've not seen.

Thanks for your assistance.


Re: Sphinx syntax errors (Elkarte 1.0.1, Sphinx 2.0.4)

Reply #5

Just to update on this, I found the cause to the problem for the 2.0 branch of sphinx and made a PR to fix this, the fix appears to work fine in both 2.1 and 2.2 from my testing. 

QuoteWEIGHT is no longer implicitly returned, because it is not actually a column (an index attribute), but rather an internal function computed per each row (a match). You have to explicitly ask for it, using the WEIGHT() function. (The requirement to alias the result will be lifted in the next release.)

Thats from 2.0, The key there is in the ()'s which means in 2.0 you can't just use WEIGHT() but have to do a WEIGHT() weight and then use that alias weight in the query.  Fortunately the alias thing works fine in 2.1+ so the same query can be used.