[Cubicweb] Full text request

Fabrice Nourisson fabrice at secondweb.fr
Thu Nov 19 08:57:46 CET 2009


I would like to make a query which returns all the CWUser which contain 
'second'  or 'web'

By default a full text query searches the correspondence of all searched 
words, e.g. to_tsquery('simple', 'second&web') in Postgres.
But for this rql : Any X WHERE X is CWUser, X has_text "second web" 
 returns all the CWUser which contain 'second' and 'web'

in postgres the request I want to make is the following one :
SELECT X.cw_eid, ts_rank_cd(appears0.words, query) AS rank FROM 
cw_CWUser AS X, appears AS appears0,  to_tsquery('simple', 'second|web') 
AS query WHERE X.cw_eid=appears0.uid AND  appears0.words @@ query ORDER 
BY rank DESC LIMIT 10;

I have to add the standard ranking function to order CWUser, depending 
on if CWUser contains the 2 searched words or only one.

Is-it possible to make such a request in CW ?
If not, is it possible to improve CW to be able to perform this kind of 


More information about the Cubicweb mailing list