Обсуждение: Full text and removing dashes from names

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

Full text and removing dashes from names

От
Asmir Mustafic
Дата:
Hi everybody!

I have a little problem with postgres 9.0 full text functionalities.

I have a document containing this string: "marko-jennifer/mary"
I have to match that document with words like "marko", "jennifer" or
"mary", but i can't find a way to do it.

Doing a dubug query i get:

select ts_lexize('public.dict', 'marko-jennifer/mary') ,
to_tsvector('public.generic', 'marko-jennifer')

return
ts_lexize    to_tsvector
{marko-jennifer/mary}    ''


I can't use language based  stemming because names  should not be be
stemmed)

How can i replace "-" and "/" with spaces and obtain (also other symbols
like dots, commas..):

select ts_lexize('public.dict', 'marko-jennifer/mary') ,
to_tsvector('public.generic', 'marko-jennifer/mary')

return
ts_lexize    to_tsvector
{marko jennifer mary}    {marko,jennifer,mary}


?

PS: i can't do  things like select ts_lexize('public.dict',
translate('marko-jennifer/mary', '-', ' ')) ...

Thanks in advice

Asmir

Re: Full text and removing dashes from names

От
Kevin Grittner
Дата:
Asmir Mustafic <asmir@lignano.it> wrote:=0A=0A> I can't use language based=
=A0 stemming because names=A0 should not be=0A> be stemmed)=0A=0AIf you hav=
e a column that explicitly contains names, I recommend=0Atrigram similarity=
 searching.=A0 I have found trigram similarity much=0Abetter than document-=
oriented full text searches, LIKE, or regular=0Aexpressions for names.=A0 I=
f you want a general document search that=0Auses some special rules in addi=
tion to what you get out of the=0Adictionaries, I have had good results pic=
king out relavent parts=0Ausing regular expressions, building that into a s=
tring and casting=0Ait to tsvector, then concatenating that tsvector with w=
hat came=0Afrom the lexeme/dictionary evaluation.=0A=0A-- =0AKevin Grittner=
=0AEnterpriseDB: http://www.enterprisedb.com=0AThe Enterprise PostgreSQL Co=
mpany