Re: tsearch strategy for incremental search - Mailing list pgsql-general

From Pierre Thibaudeau
Subject Re: tsearch strategy for incremental search
Date
Msg-id 74b035bb0806292238l319a0eaexbd2a599e393d5bf0@mail.gmail.com
Whole thread Raw
In response to tsearch strategy for incremental search  ("Pierre Thibaudeau" <pierdeux@gmail.com>)
Responses Re: tsearch strategy for incremental search  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-general
2008/6/30 Oleg Bartunov <oleg@sai.msu.su>:
> tsearch will have prefix search support in 8.4.

Thanks Oleg!  That's fantastic news!

In the meantime, carrying on with my earlier idea, here's the little
function I came up with for extracting the 3-char-lexeme tsvector, in
case anyone's interested:

CREATE OR REPLACE FUNCTION public.to_three_char_tsvector(str text)
  RETURNS tsvector AS
$BODY$declare
somerow record;
shortened_text text := '';
BEGIN
FOR somerow IN SELECT regexp_split_to_table(trim(both '\'' from
strip(to_tsvector('simple',str))::text),'\'') AS item LOOP
    shortened_text := shortened_text || ' ' ||
COALESCE(substring(somerow.item for 3), '');
END LOOP;
RETURN strip(to_tsvector(shortened_text));
END;$BODY$
  LANGUAGE 'plpgsql' IMMUTABLE;

pgsql-general by date:

Previous
From: Artacus
Date:
Subject: Re: Probably been asked a hundred times before.
Next
From: Oleg Bartunov
Date:
Subject: Re: tsearch strategy for incremental search