I want to explain how we implemented elasticsearch on NefisYemekTarifleri.com
About NefisYemekTarifleri: nefisyemektarifleri.com is largest recipe site of Turkey. We have more than 120k recipes that reaching millions of users.
1) Everybody hate expensive %like% queries. In fact, we hate queries hitting mysql directly. So need to prevent them.
2) We want to provide better search experience. For example, when users want cook italian pizza that include cheese and olives without pepper and cook within 45 minutes.”, we need to find result.
We are using ElasticPress behind our custom wrapper plugin. It is great plugin that directly integrates with the WP_Query object returning results from Elasticsearch. Our wrapper plugins solve some specific problems by using ElasticPress’s filters and actions.
Taxonomies help us to understand recipe’s properties and using them to filtering results. We have more than 10 custom taxonomies that helps to find answers. Which cuisine? Which cooking techniques? What kind of occasions? cooking time? etc…
Too hard to manage taxonomies!
Our editorial team publishing hundreds of post every day and previous posts haven’t taxonomies. So here is the question, how to handle taxonomies without pain?
– Answer is, ask to people. We are community driven network.
And, we wrote new plugin “taxonomy feeder” 🙂
Taxonomy feeder, asking question about recipes and collecting answers to filling missing taxonomies. For example, people says that recipe is salty, that’s salty.
Asking simple yes/no question to understanding difficulty level.
Autocompletion like twitter, finding search terms and users.
We’ve used Elasticsearch’s completion suggester but want to suggest popular terms. So we get results from google analytics and unfortunately, we are still using mysql for users.
Look at bottom of image, hot searches listed. Keeping searches with another index, and serving hottest results within latest 5 minutes.
Turkish alphabet has non-english letters, (İ,Ö,Ç,ç,ğ,Ğ,ü,Ü,Ş,ş) and this is another problem to solve.
For example, I’m using English keyboard and if I wrote “kasarli pogaca” instead of “kaşarlı poğaça” I can’t get any result without fuzziness.
$analyzer = array('type' => 'custom', 'tokenizer' => 'icu_tokenizer', 'filter' => array( 'standard', 'lowercase','icu_normalizer','icu_folding' ), 'language' => 'Turkish', )
Summary and Future Plans
Our brand new search engine is not available for publicly, it will be available when taxonomies done.
Implementation of search system is not easy, key point is understanding to “search terms meaning” for user. Elasticsearch is dramatically fast search engine and ElasticPress is the bridge between Elasticsearch and WordPress. (Thanks 10up)
We want to use elasticsearch for all WP_Queries. – (trying https://github.com/alleyinteractive/es-wp-query)