Re: Postgres function for full text search

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема Re: Postgres function for full text search
Дата
Msg-id 20110124110847.3bef4f9e@dawn.webthatworks.it
обсуждение исходный текст
Ответ на Postgres function for full text search  (- <grandebuzon@gmail.com>)
Список pgsql-sql
On Mon, 24 Jan 2011 10:38:02 +0100
- <grandebuzon@gmail.com> wrote:

> Hello everyone.
> My question if any known one postgres function, for full text
> search that separates words with "| "?
> As plainto_tsquery separating words with "& ".
> 
> For example text "word1 word2 word3 word4"
> and conversion rates for full text search postgres "word1 | word2
> | word3 | word4"

I wrote a C extension that could help...

Currently there are
CREATE OR REPLACE FUNCTION tsvector_to_table(
IN tsv tsvector,
OUT lexeme text,
OUT weight smallint[],
OUT pos int[])

CREATE OR REPLACE FUNCTION tsvector_to_tsquery(
IN tsv tsvector,
op IN char(1),
weights IN varchar(4),
maxpos IN smallint )
RETURNS tsquery

op is | or &
It will ignore elements in the tsvector whose position is >maxpos.
It will ignore elements whose weight is not in weights

So it could turn
gino:1,3,5A pino:2B into
gino:A | pino:B

The code has been working in production by several months but:
- it is for 8.3 (there are some notes to port it to >8.4, namely supporting prefixes)
- I wrote it for my environment so the "build" script are simple but you'll have to adjust them to your environment.

The code could be released in GPL or FreeBSD license.
I'd be happy if someone could guide me in the process of
successfully donating this code to the community.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



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

Предыдущее
От: Piotr Czekalski
Дата:
Сообщение: Re: loosing data in postgres database
Следующее
От: manuel antonio ochoa
Дата:
Сообщение: check files .backup