Florian Mac Langlade
Florian Mac Langlade

Reputation: 1903

Sphinx search php - Good practice

I'm integrating sphinx search with php api in my website and I've got a question.

What is the best practice : - Select only IDs with sphinx, and make an other request in mysql in order to select the other fields (I've some join), with a WHERE IN (ids...) SQL request (but how to keep the same order ?) - Select all datas with sphinx

Thanks.

Upvotes: 0

Views: 157

Answers (1)

eRIZ
eRIZ

Reputation: 1507

I recommend selecting only IDs and then WHERE IN.

Why? For example, you have to search within articles and then - associate them with authors. Why duplicate data you're not searching within? Sphinx/Lucene/ElasticSearch primary objective is to index and accelerate process but NOT to replace a database (of course, I'm not saying that's impossible but what's the purpose?).

The less data to index, the faster you get the results.

Upvotes: 2

Related Questions