Full text search in PostgreSQL 8.4

Lists: pgsql-general
From: Konstantin Pavlov <varicond(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Full text search in PostgreSQL 8.4
Date: 2009-07-19 21:17:57
Message-ID: 902187.75174.qm@web112520.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


Hello,

I recently upgraded to version 8.4 and now full text search with russian configuration is not working:

template1=# create database test encoding='win1251';
test=# create table test ("test" varchar(255));
test=# insert into test values ('тест');
test=# select * from test where to_tsvector('russian', test) @@ to_tsquery('russian', 'тест');

In 8.3 version I have result:
test
------
тест
(1 запись)


In 8.4 I have this notice and 0 rows with any table values:
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
test
------
(0 rows)

Why it may not working in 8.4 version?

Thanks


From: Andreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Full text search in PostgreSQL 8.4
Date: 2009-07-20 11:10:09
Message-ID: 4A645091.8090301@netzmeister-st-pauli.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

> Hello,
>
>
> I recently upgraded to version 8.4 and now full text search with russian
> configuration is not working:
>
>
> template1=# create database test encoding='win1251';
>
> test=# create table test ("test" varchar(255));
>
> test=# insert into test values ('тест');
>
> test=# select * from test where to_tsvector('russian', test) @@
> to_tsquery('russian', 'тест');
>
>
>
> In 8.3 version I have result:
>
> test
>
> ------
>
> тест
>
> (1 запись)
>
>
>
>
> In 8.4 I have this notice and 0 rows with any table values:
>
> NOTICE: text-search query contains only stop words or doesn't contain
> lexemes, ignored
>
> test
>
> ------
>
> (0 rows)
>
>
> Why it may not working in 8.4 version?
>
>
>
>
> Thanks
>
>

Hi Konstantin,

I ran your tests with 8.3 and 8.4. I have the expected result:

postgres=# \c test
psql (8.4.0)
You are now connected to database "test".
test=# create table test ("test" varchar(255));
CREATE TABLE
test=# insert into test values ('тест');
INSERT 0 1
test=# select * from test where to_tsvector('russian', test) @@ to_tsquery('russian', 'тест');
test
------
тест
(1 row)

I have a clean installation - means the dictionarys are not edited. After insterting тест
into the russian.stop file, I can reproduce your case:

test=# select * from test where to_tsvector('russian', test) @@ to_tsquery('russian', 'тест');
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
test
------
(0 rows)

If you would have given the column test the data type tsvector, probably no value would
have been inserted. Just try it with another column and see if you can insert тест into
that column.

This is just an idea ...

Cheers Andy


From: Konstantin Pavlov <varicond(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Full text search in PostgreSQL 8.4 [SOLVED]
Date: 2009-07-21 11:37:44
Message-ID: 579269.63637.qm@web112509.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello,

The problem was with locale. To fix it I changed it to ru_RU.CP1251 and now everything works as expected.

---
Konstantin Pavlov