Using multiple indexes in SphinxQl and searching across fields from multiple indexes

1.7k views Asked by At

So guys I have multiple indexes in Sphinx

eg 3 Indexes
index1 Fields: field1_1,field1_2,field1_3
index2 Fields: field2_1,field2_2,field2_3
index3 Fields: field3_1,field3_2,field3_3

I want to search across these three indexes and my search string should be matched across all these fields.

I tried

$query="select * from index1,index2,index3 Match(@(field1_1,field1_2,field1_3,field2_1,field2_2,field2_3,field3_1,field3_2,field3_3) $searchstring)";

But this is throwing some error.How do I achieve something like this. Thanks

2

There are 2 answers

0
barryhunter On BEST ANSWER

But this is throwing some error.

You should actully read the error message, rather than just dismissing it as 'some error'. Error messages are there to help you figure out what is wrong.

But looking at your query, its not valid SphinxQL. Look closer at the documentation, and the example queries... http://sphinxsearch.com/docs/current.html#sphinxql-select

1
vfedorkov On

Sphinx merges indexes schema leaving only common fields across all used indexes. Please make sure you're searching though common fields.