简体   繁体   中英

MATCH - AGAINST in CakePHP

I am new in CakePHP and now I can't transform the query:

SELECT *, 
MATCH (title, post, tags) AGAINST ('dialux' IN BOOLEAN MODE) as REL
FROM posts 
WHERE MATCH (title, post, tags) AGAINST ('dialux' IN BOOLEAN MODE)
ORDER BY REL DESC;

in something like this:

$this->Post->find('all', xxx);

Any ideas? Thanks.

Not sure if this is helpful as it is from the page that has already been suggested by mark

But you could try something like this:

$query = 'SELECT *, 
MATCH (title, post, tags) AGAINST ('dialux' IN BOOLEAN MODE) as REL
FROM posts 
WHERE MATCH (title, post, tags) AGAINST ('dialux' IN BOOLEAN MODE)
ORDER BY REL DESC;';

$this->Post->query($query);

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