Sunday, March 13, 2022

[FIXED] Cakephp simple search engine tutorial

Issue

Does anyone know good tutorial step by step how to create a simple search engine, I just need to add a search feature, which would find similar phrase to content of my database fields. And if it's possible I don't want to use any plugins.


Solution

I just need to add a search feature, which would find similar phrase to content of my database fields

If your requirement is that simple then you can just stick to Model::find() and setting conditions according to your needs, for example:

$results = $this->Article->find('all', array(
    'conditions' => array('Article.title LIKE' => "%". $text ."%")
))

If your search conditions are more complex then you would need to use a more sophisticated solution, i.e. a plugin. I am going to be a little biased here and will recommend our search plugin



Answered By - Guillermo Mansilla

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.