How to give non id WHERE condition in sphinx search source conf for indexing mysql table

StackOverflow https://stackoverflow.com/questions/21335312

  •  02-10-2022
  •  | 
  •  

Pregunta

I am currently indexing a mysql table using sphinx. I want the index by giving a condition in query apart from id.

My sql_query is

SELECT id, group_id, concat(ifnull(title, ""), ifnull(tags, "")) \
                FROM items \
                 WHERE group_id in (262, 147, 165, 190, 256, 272, 442, 577, 933) and id>=$start AND id<=$end;

My sql_info is

SELECT id, concat(ifnull(title, ""), ifnull(tags, "")) FROM items WHERE group_id in (262, 147, 165, 190, 256, 272, 442, 577, 933) and id=$id;

But, when I try to index the table using there queries, the index fails. 1) Am I missing anything in the above queries.? 2) How do I index queries by giving conditions?

¿Fue útil?

Solución

My guess is you should give an alias to your compound text statement, sphinx might well choke on trying to create an field called concat(ifnull(title, ""), ifnull(tags, "")).

SELECT id, group_id, concat(ifnull(title, ""), ifnull(tags, "")) AS text \
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top