agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
question about to_tsvector and to_tsquery
2+ messages / 2 participants
[nested] [flat]

* question about to_tsvector and to_tsquery
@ 2021-08-24 12:01  Martin Norbäck Olivers <martin@norpan.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Martin Norbäck Olivers @ 2021-08-24 12:01 UTC (permalink / raw)
  To: pgsql-sql@lists.postgresql.org

Is there any more information on exactly how to_tsquery and to_tsvector are
supposed to work?

select to_tsvector('simple', '1.b') gives '1':1 'b':2
but
select to_tsvector('simple', '1.bb') gives '1.bb':1

select to_tsquery('simple', '1.b:*') gives '1':* & 'b':*
but
select to_tsquery('simple', '1.bb:*') gives '1.bb':*

Regards,
Martin

-- 
Martin Norbäck Olivers
IT-konsult, Masara AB
Telefon: +46 703 22 70 12
E-post: martin@norpan.org
Kärrhöksvägen 4
656 72 Skattkärr

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: question about to_tsvector and to_tsquery
@ 2021-08-24 14:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Martin Norbäck Olivers <martin@norpan.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-08-24 14:12 UTC (permalink / raw)
  To: Martin Norbäck Olivers <martin@norpan.org>; +Cc: pgsql-sql@lists.postgresql.org

=?UTF-8?Q?Martin_Norb=C3=A4ck_Olivers?= <martin@norpan.org> writes:
> Is there any more information on exactly how to_tsquery and to_tsvector are
> supposed to work?

> select to_tsvector('simple', '1.b') gives '1':1 'b':2
> but
> select to_tsvector('simple', '1.bb') gives '1.bb':1

ts_debug gives a little bit of insight:

postgres=# select * from ts_debug('simple', '1.b');
   alias   |   description    | token | dictionaries | dictionary | lexemes 
-----------+------------------+-------+--------------+------------+---------
 uint      | Unsigned integer | 1     | {simple}     | simple     | {1}
 blank     | Space symbols    | .     | {}           |            | 
 asciiword | Word, all ASCII  | b     | {simple}     | simple     | {b}
(3 rows)

postgres=# select * from ts_debug('simple', '1.bb');
 alias | description | token | dictionaries | dictionary | lexemes 
-------+-------------+-------+--------------+------------+---------
 host  | Host        | 1.bb  | {simple}     | simple     | {1.bb}
(1 row)

I don't know the exact rules that cause classification of something
as a "host" token.  It does seem a little weird that length matters.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-08-24 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 12:01 question about to_tsvector and to_tsquery Martin Norbäck Olivers <martin@norpan.org>
2021-08-24 14:12 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox