cdbcriteria and select, strange result if parameter is an expression

I tried adding a calculated column into the “select” property of a CDbCriteria, it doesn’t work . I also tried using an array.


	$q = new CDbCriteria(array(

  	'scopes' => 'notOwnedByUser',

  	'select' => '*, (MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST ('*$match*')) AS SCORE',

  	'join' => 'LEFT JOIN tbl_book_ftsearch ON t.id = tbl_book_ftsearch.id',

  	'condition' => "LOWER(author) LIKE :match OR LOWER(publisher) LIKE :match OR MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST ('*$match*' IN BOOLEAN MODE)",

  	'order' => 'score DESC',

  	'params' => array(':match' => "%$match%")

	));

I’m doing something wrong or is it a bug?

Thanks

I also tried


 

  	'select' => array('*', '(MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST ('*$match*')) AS SCORE'),



I’ve found this workaround that seems to work without using select


'order' => '(MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST ('*$match*')) DESC',

Sure it isn’t a case issue? SCORE vs score?

Loll, no , I tried also with all lowercase

The problem is that the generated query is

Can you give the code you use to run the query?

nope, just figured out now that I was writing

‘select’ => ', (MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST (’$match*’)) AS score,

instead of

‘select’ => ", (MATCH (tbl_book_ftsearch.title, tbl_book_ftsearch.description) AGAINST (’$match*’)) AS score",

now the select is built as it should be :D but I have to modify the query a little to make it works because now I get “Can’t find FULLTEXT index matching the column list.”

better go bed now and resume tomorrow :-X