db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tulsi Das <quixote_...@yahoo.com>
Subject problems with alias (and Criteria, this time)
Date Fri, 10 Oct 2003 12:19:47 GMT
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


Mime
View raw message