Full Text Search - Influenceing the creation of tsvector

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

Full Text Search - Influenceing the creation of tsvector

От:
Pauline Dubois <paulinedubois@rocketmail.com>
Дата:
Dear all,

like described in the docs i have created a separate tsvector column to hold the output of to_tsvector.
UPDATE foo_table SET textsearchable_index_col =
to_tsvector('english', coalesce(name,'')
The problem is that i have names like  'foo-bar'.
The char '-' is a space symbol.
The tsvector lokks like:
"'bar':3 'foo':2 'foo-bar':1"

A
"SELECT *
FROM foo_table
WHERE textsearchable_index_col @@ to_tsquery('foo')"

finds now 'foo-bar', but this is not what i want because i have 'foo-bar1,foo-bar2..'. Because of performace only 'foo-bar(n)' should match.

The docs are good but a bit intimidating and i don't understand all.

Is there a way to create the tsvector lokks like:
"''foo-bar':1" so that the space symbol would be ignored?

best regards,
pauline

Re: Full Text Search - Influenceing the creation of tsvector

От:
ANdreas Wenk <a.wenk@netzmeister-st-pauli.de>
Дата:
Pauline Dubois wrote:
> Dear all,
> 
> like described in the docs i have created a separate tsvector column to 
> hold the output of |to_tsvector|.
> 
> UPDATE foo_table SET textsearchable_index_col =
>      to_tsvector('english', coalesce(name,'')
> 
> The problem is that i have names like  'foo-bar'.
> The char '-' is a space symbol.
> The |tsvector lokks like:|
> "'bar':3 'foo':2 'foo-bar':1"
> 
> A
> "SELECT *
> FROM foo_table
> WHERE textsearchable_index_col @@ to_tsquery('foo')"
> 
> finds now 'foo-bar', but this is not what i want because i have 
> 'foo-bar1,foo-bar2..'. Because of performace only 'foo-bar(n)' should match.
> 
> The docs are good but a bit intimidating and i don't understand all.
> 
> Is there a way to create the |tsvector lokks like:|
> "''foo-bar':1" so that the space symbol would be ignored?
> 
> best regards,
> pauline
> 
> 
Hi Pauline,

I don't think that you will be able to manage that inbetween the 
fulltextsearch functions. But you should give it a try with Regular 
Expressions:

http://www.postgresql.org/docs/8.4/static/functions-matching.html

Cheers

Andy

FAQ