Trouble with text search select statement

Поиск
Список
Период
Сортировка
От Mont Rothstein
Тема Trouble with text search select statement
Дата
Msg-id 467a83630804301641o5985186n4151e0f44a427e43@mail.gmail.com
обсуждение исходный текст
Ответы Re: Trouble with text search select statement
Список pgsql-general
I am having trouble getting a multiple column text search select statement to work.

I've setup the following:

CREATE TABLE tstest (col1 text, col2 text);
INSERT INTO tstest (col1, col2) VALUES ('bird', 'moon');
CREATE INDEX tstest_ts_idx ON tstest USING gin(to_tsvector('english', coalesce(col1, '') || '' || coalesce(col2, '')));

I then execute what I believe is the correct select statement:

SELECT * FROM tstest WHERE to_tsvector('english', coalesce(col1, '') || '' || coalesce(col2, '')) @@ to_tsquery('english', 'bird');

If I remove the second column from the to_tsvector in the select statement then it returns the row.

SELECT * FROM tstest WHERE to_tsvector('english', coalesce(col1, '')) @@ to_tsquery('english', 'bird');

I know I've missed something basic but I can't figure out what.

As a side note I don't understand the purpose of the || '' || between the columns in the to_tsvector.  I saw it in several examples.  I've tried both with and without it with no change.

Thanks in advance.

-Mont

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ruben Guinez"
Дата:
Сообщение: Full Text Search. In 8.3.1 How ?
Следующее
От: Klint Gore
Дата:
Сообщение: Re: Trouble with text search select statement