Hello everyone. This is my first question here. I would appreciate it if you could help me with this question.
I am interested in being able to sort the results of a search using as a sort criteria which field/s matches with the condition.
A simple example, I have a table of products that contains the fields: title, description … a simple search would look like this:
$products = $this->Product->find('all', array(
'conditions' => array(
'Product.title LIKE' => '%'.$keyword.'%',
'Product.description LIKE' => '%'.$keyword.'%',
),
));
I’m interested in having the results in this order:
1st: Records containing $keyword in title field and description
2nd: Records containing the $keyword only in the title
3rd: Records containing $keyword only in description
How do you propose to make this query to work on a cakephp 1.3?
Many thanks!!!
Pito