Re: a tsearch issue - Mailing list pgsql-hackers

From Sushant Sinha
Subject Re: a tsearch issue
Date
Msg-id 1320582817.6603.2.camel@dragflick
Whole thread Raw
In response to a tsearch issue  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Fri, 2011-11-04 at 11:22 +0100, Pavel Stehule wrote:
> Hello
>
> I found a interesting issue when I checked a tsearch prefix searching.
>
> We use a ispell based dictionary
>
> CREATE TEXT SEARCH DICTIONARY cspell
>    (template=ispell, dictfile = czech, afffile=czech, stopwords=czech);
> CREATE TEXT SEARCH CONFIGURATION cs (copy=english);
> ALTER TEXT SEARCH CONFIGURATION cs
>    ALTER MAPPING FOR word, asciiword WITH cspell, simple;
>
> Then I created a table
>
> postgres=# create table n(a varchar);
> CREATE TABLE
> postgres=# insert into n values('Stěhule'),('Chromečka');
> INSERT 0 2
> postgres=# select * from n;
>      a
> ───────────
>  Stěhule
>  Chromečka
> (2 rows)
>
> and I tested a prefix searching:
>
> I found a following issue
>
> postgres=# select * from n where to_tsvector('cs', a) @@
> to_tsquery('cs','Stě:*') ;
>  a
> ───
> (0 rows)

Most likely you are hit by this problem.
http://archives.postgresql.org/pgsql-hackers/2011-10/msg01347.php

'Stě' may be a stopword in czech.

> I expected one row. The problem is in transformation of word 'Stě'
>
> postgres=# select * from ts_debug('cs','Stě:*') ;
> ─[ RECORD 1 ]┬──────────────────
> alias        │ word
> description  │ Word, all letters
> token        │ Stě
> dictionaries │ {cspell,simple}
> dictionary   │ cspell
> lexemes      │ {sto}
> ─[ RECORD 2 ]┼──────────────────
> alias        │ blank
> description  │ Space symbols
> token        │ :*
> dictionaries │ {}
> dictionary   │ [null]
> lexemes      │ [null]
>

':*' is only specific to to_tsquery. ts_debug just invokes the parser.
So this is not correct.

-Sushant.



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Include commit identifier in version() function
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] Strange problem with create table as select * from table;