0
我很难将以下查询翻译成kohana的ORM。使用Kohana的ORM构建MySql查询
所以,如果我做了以下工作正常:
$query = DB::query(Database::SELECT, 'SELECT id_book, MATCH(title, author, isbn) AGAINST (:str) AS score FROM tab_books WHERE status = 1 AND MATCH(title, author, isbn) AGAINST (:str) HAVING score > '.$score.' ORDER BY score DESC LIMIT 100');
不过,我需要使用特定的类模型。到目前为止,我有:
$books = new Model_Book();
$books = $books->where('status', '=', 1);
$books = $books->where(DB::expr('MATCH(`title`,`author`,`isbn`)'), 'AGAINST', DB::expr("(:str)"))->param(':str', $search_terms);
这工作正常,除了我无法使用得分值的事实。我需要得分,因为自从我将表引擎更改为InnoDB后,第二个查询返回了很多结果。
ORM这里:https://github.com/kohana/orm/blob/3.3/master/classes/Kohana/ORM.php
谢谢您的时间。
谢谢bato3。 – Raphael