You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Tulsi Das <qu...@yahoo.com> on 2003/10/10 14:19:47 UTC

problems with alias (and Criteria, this time)

Hello again!

I´m experiencing again problems when doing criteria that uses alias.

This time I cannot get a Criteria to filter by an alias field

this is what I want:

SELECT actividad.ACTIVIDAD_ID, actividad.ACTIVIDAD, MATCH
(actividad.ACTIVIDAD) AGAINST ('futbol') AS score FROM actividad, 
WHERE MATCH (actividad.ACTIVIDAD) AGAINST ('futbol') AND .score>=0.5
ORDER BY score DESC LIMIT 1

and here is my code:

String matchString = "MATCH ("+ActividadPeer.ACTIVIDAD+") AGAINST
futbol";
Criteria crit = new Criteria();		
crit.add(ActividadPeer.ACTIVIDAD, (Object)matchString,
Criteria.CUSTOM);
crit.addAsColumn("score", matchString);
crit.add("score", 0.5, Criteria.GREATER_EQUAL);

crit.addDescendingOrderByColumn("score");
crit.setLimit(1);


I´ve already patched BasePeer so that I can sort by the "score" alias
field, by when doing the crit.add(...), you can notice that in the
generated SQL it inserts a dot in "AND .score>=0.5"

any workaround?

thank you very much

Tulsi

------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org