tsearch partial word

Started by Yudie Pgalmost 20 years ago4 messagesgeneral
Jump to latest
#1Yudie Pg
yudiepg@gmail.com

Is it possible to search partial word as *like '%...%'* in tsearch?

Yudie

#2Joshua D. Drake
jd@commandprompt.com
In reply to: Yudie Pg (#1)
Re: tsearch partial word

On Mon, 2006-04-17 at 14:48 -0500, Yudie Pg wrote:

Is it possible to search partial word as like '%...%' in tsearch?

Well at that point you are just going to seqscan anyway... so why not
just to a standard like search?

The could see that you might get a benefit from using the '%...%' on the
vectors columns though, as you may be scanning less data.

Joshua D. Drake

Yudie

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Yudie Pg (#1)
Re: tsearch partial word

Tsearch doesn't support such scan. You can add your own operation or modify
existing, but in any case index will not support it.

I don't known efficient index structure for queries you need...

Yudie Pg wrote:

Is it possible to search partial word as *like '%...%'* in tsearch?

Yudie

--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

#4Hannes Dorbath
light@theendofthetunnel.de
In reply to: Yudie Pg (#1)
Re: tsearch partial word

On 17.04.2006 21:48, Yudie Pg wrote:

Is it possible to search partial word as *like '%...%'* in tsearch?

You can create a table with all the unique lexems (see pg_trgm doc on
how to do that) use LIKE %<whatever>% on it, join the matching lexems
with | in your ts_query..

It works ok as long as the count of returned lexems is low.. at some
point a seq scan would be faster again, so you might want to add a
threshold to fall back to that..

--
Regards,
Hannes Dorbath