Behaviour of to_tsquery(stopwords only)

From: Richard Huxton <dev(at)archonet(dot)com>
To: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Behaviour of to_tsquery(stopwords only)
Date: 2008-03-06 10:19:00
Message-ID: 47CFC514.6030800@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2008-03-06 11:08:05 Re: Behaviour of to_tsquery(stopwords only)
Previous Message Pavan Deolasee 2008-03-06 09:07:01 Re: 8.3.0 Core with concurrent vacuum fulls