tags:

views:

33

answers:

2

Hello, One would normally have this query in their sphinx.conf file :

sql_query = SELECT id,text_field1,text_field2,text_field3 FROM table_name

Would there be much difference if I combine all fields into one searchable text field like so?

sql_query = SELECT id, CONCAT(text_field1,text_field2,text_field3) as searchable_text FROM table_name

What benefits does one have over the other?

Thanks!

+1  A: 

I think either way is generally fine... however, Sphinx has the ability to focus queries at certain fields (see the extended query syntax examples). If you merge all the columns into one field, you'll lose that ability.

You'll also lose the ability to weight certain fields higher than others.

pat
A: 

CONCAT(text_field1,text_field2,text_field3) is wrong use CONCAT(text_field1,' ',text_field2,' ',text_field3)

but it's better to let index separate fields

search returns same result but you can select one of list if needed

'@text_field2 foo'

Moosh

related questions