Обсуждение: Full text search in PostgreSQL 8.4

Поиск
Список
Период
Сортировка

Full text search in PostgreSQL 8.4

От
Konstantin Pavlov
Дата:
p, li { white-space: pre-wrap; }

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


Re: Full text search in PostgreSQL 8.4

От
Andreas Wenk
Дата:
> 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

Re: Full text search in PostgreSQL 8.4 [SOLVED]

От
Konstantin Pavlov
Дата:
Hello,

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

---
Konstantin Pavlov