Fulltext search

Hello, I’ve made a fulltext search in my site, but I have a problem. I want to order the results by relevant but I can’t put the match query into the select.

I’m trying to do sth like that:

$criteria->select = "MATCH (title, content, tags) AGAINST ('*{$_GET['q']}*'  IN BOOLEAN MODE) as relevance";

But the Yii framework tells me that there’s no column MATCH (title".

Is there any way to use the fulltext search or can I "lie" the Yii and use it in the select?

Thank you :)

I would guess that you have to specify MATCH … AGAINST … in the WHERE clause, not in SELECT part. But I’m not at all familiar with MATCH AGAINST. Maybe you can give it a try.

Yes, it’s in where clause, but i want to put it also in the select part, because i want to order by relevance :)

Try this:

$criteria->select = array(

	"MATCH (title, content, tags) AGAINST ('*{$_GET['q']}*'  IN BOOLEAN MODE) as relevance"


I suppose it should take it as a single column and not split into comma-separated chunks. It is just a guess. Hope it helps.

No, it’s not working. The part witch the match is not in the query. It’s not giving any error, it’s just missing

My mistake, it’s working perfectly. I was the problem. Big thanks :)