简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM