[Cubicweb] Full text request

Sylvain Thénault sylvain.thenault at logilab.fr
Fri Nov 20 15:43:08 CET 2009


On 19 novembre 08:57, Fabrice Nourisson wrote:
> Hi,
> 
> 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 queries?

there is already a ticket on the indexer project to handle such queries.
That wouldn't be that hard to implement if someone can take one day or
two on it. You could do that easily during the sprint for example :p
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org




More information about the Cubicweb mailing list