Обсуждение: Partial substrings in FTS

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

Partial substrings in FTS

От
A J
Дата:
In FTS, how do I search for partial substrings that don't form a English word.
Example, in the text: 'one hundred thirty four'  I want to find the records based on 'hun'

SELECT to_tsvector('one hundred thirty four') @@ to_tsquery('hun');
does not return anything.

Thanks.

Re: Partial substrings in FTS

От
"Kevin Grittner"
Дата:
A J <s5aly@yahoo.com> wrote:
> In FTS, how do I search for partial substrings that don't form a
> English word.
> Example, in the text: 'one hundred thirty four'  I want to find
> the records based on 'hun'
>
> SELECT to_tsvector('one hundred thirty four') @@
> to_tsquery('hun'); does not return anything.

It sounds like trigrams might be a better fit for you than text
search.

http://www.postgresql.org/docs/9.1/static/pgtrgm.html

-Kevin

Re: Partial substrings in FTS

От
Jesper Krogh
Дата:

On 23/04/2012, at 19.10, A J <s5aly@yahoo.com> wrote:

In FTS, how do I search for partial substrings that don't form a English word.
Example, in the text: 'one hundred thirty four'  I want to find the records based on 'hun'

SELECT to_tsvector('one hundred thirty four') @@ to_tsquery('hun');
does not return anything.

Try to_tsquery('hun:*') 

Jesper