Behaviour of to_tsquery(stopwords only) - Mailing list pgsql-hackers

From Richard Huxton
Subject Behaviour of to_tsquery(stopwords only)
Date
Msg-id 47CFC514.6030800@archonet.com
Whole thread Raw
Responses Re: Behaviour of to_tsquery(stopwords only)  (Richard Huxton <dev@archonet.com>)
List pgsql-hackers
I'm not sure what value a tsquery has if it's composed from stopwords 
only, but it doesn't seem to be null or equal to itself.

That strikes me as ... unintuitive, although I'm happy to be re-educated 
on this.

I think it's because CompareTSQ (tsquery_op.c, line 142) doesn't have a 
case to handle query sizes of zero. That's what seems to be returned 
from tsearch/to_tsany.c lines ~ 345-350.


SELECT  qid,words,query,  (query is null) AS isnull,  (query = to_tsquery(words)) as issame
FROM  util.queries
ORDER BY qid DESC LIMIT 5;

NOTICE:  text-search query contains only stop words or doesn't contain 
lexemes, ignored
NOTICE:  text-search query contains only stop words or doesn't contain 
lexemes, ignored qid  |  words   |   query    | isnull | issame
------+----------+------------+--------+-------- 1000 | to       |            | f      | f  999 | or       |
|f      | f  998 | requests | 'request'  | f      | t  997 | site     | 'site'     | f      | t  996 | document |
'document'| f      | t
 
(5 rows)

--   Richard Huxton  Archonet Ltd


pgsql-hackers by date:

Previous
From: "Pavan Deolasee"
Date:
Subject: Re: 8.3.0 Core with concurrent vacuum fulls
Next
From: Richard Huxton
Date:
Subject: Re: Behaviour of to_tsquery(stopwords only)