Answer the question
In order to leave comments, you need to log in
How to merge the result of multiple SphinxQL queries, grouped by key?
On the Russian forum of the sphinx, the question hung for two weeks without an answer. I'll try to ask here.
There are two requests:
SELECT *, (10*weight()) AS qweight FROM elverIndex WHERE MATCH('ZONESPAN:(h1,h2)
ТоЧтоЯИщу') LIMIT 0,1000
SELECT *, (5*weight()) AS qweight FROM elverIndex WHERE MATCH('ZONESPAN:(h3,h4)
ТоЧтоЯИщу') LIMIT 0,1000
SELECT *, tweight AS SUM(`qweight`) FROM (SELECT *, (10*weight()) AS qweight FROM
elverIndex WHERE MATCH('ZONESPAN:(h1,h2) ТоЧтоЯИщу') LIMIT 0,1000 UNION SELECT *,
(5*weight()) AS qweight FROM elverIndex WHERE MATCH('ZONESPAN:(h3,h4) ТоЧтоЯИщу') LIMIT
0,1000) t GROUP BY `id_attr` ORDER BY `tweight` DESC LIMIT 0,1000;
ERROR 1064 (42000): sphinxql: syntax error, unexpected '(', expecting FROM or ',' near
'(`qweight`) FROM (SELECT *, (10*weight()).......
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question