like operation in tsearch

Started by AI Rummanabout 16 years ago4 messagesgeneral
Jump to latest
#1AI Rumman
rummandba@gmail.com

I am using Postgresql 8.1 tsearch2.

I need to match a like operation in tsearch. Such as,

Sample data:

Document
......................

Rumman went to iftekhar to solve it.

select ...
from ...
where document like '%ifte%'

need to be written in tsearch. Here "ifte" is a name

But in tsearch when I am using to_tsvector, it gives as follows-

'iftekhar':4 'rumman':1 'solv':6 'went':2

postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte') as c;
c
---
f
(1 row)

I am confused how to execute the above like operation in tsearch.

Any help please.

#2Oleg Bartunov
oleg@sai.msu.su
In reply to: AI Rumman (#1)
Re: like operation in tsearch

We introduced prefix support in 8.4, so one may use:

=# select to_tsvector('Rumman went to iftekhar to solve it') @@ to_tsquery('ifte:*') as c;
c
---
t
(1 row)

On Sun, 21 Mar 2010, AI Rumman wrote:

I am using Postgresql 8.1 tsearch2.

I need to match a like operation in tsearch. Such as,

Sample data:

Document
......................

Rumman went to iftekhar to solve it.

select ...
from ...
where document like '%ifte%'

need to be written in tsearch. Here "ifte" is a name

But in tsearch when I am using to_tsvector, it gives as follows-

'iftekhar':4 'rumman':1 'solv':6 'went':2

postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte') as c;
c
---
f
(1 row)

I am confused how to execute the above like operation in tsearch.

Any help please.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

#3AI Rumman
rummandba@gmail.com
In reply to: Oleg Bartunov (#2)
Re: like operation in tsearch

Helo,

I am using Postgresql 8.1 and I found that to_tsquery('iftek:*) gives systax
error.

On Sun, Mar 21, 2010 at 12:11 PM, Oleg Bartunov <oleg@sai.msu.su> wrote:

Show quoted text

We introduced prefix support in 8.4, so one may use:

=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte:*') as c;
c ---
t
(1 row)

On Sun, 21 Mar 2010, AI Rumman wrote:

I am using Postgresql 8.1 tsearch2.

I need to match a like operation in tsearch. Such as,

Sample data:

Document
......................

Rumman went to iftekhar to solve it.

select ...
from ...
where document like '%ifte%'

need to be written in tsearch. Here "ifte" is a name

But in tsearch when I am using to_tsvector, it gives as follows-

'iftekhar':4 'rumman':1 'solv':6 'went':2

postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte') as c;
c
---
f
(1 row)

I am confused how to execute the above like operation in tsearch.

Any help please.

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: AI Rumman (#3)
Re: like operation in tsearch

2010/3/21 AI Rumman <rummandba@gmail.com>:

Helo,

I am using Postgresql 8.1 and I found that to_tsquery('iftek:*) gives systax
error.

you have to upgrade to 8.4 when you would to use this feature

regards
Pavel Stehule

Show quoted text

On Sun, Mar 21, 2010 at 12:11 PM, Oleg Bartunov <oleg@sai.msu.su> wrote:

We introduced prefix support in 8.4, so one may use:

=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte:*') as c;
 c ---
 t
(1 row)

On Sun, 21 Mar 2010, AI Rumman wrote:

I am using Postgresql 8.1 tsearch2.

I need to match a like operation in tsearch. Such as,

Sample data:

Document
......................

Rumman went to iftekhar to solve it.

select ...
from ...
where document like '%ifte%'

need to be written in tsearch. Here "ifte" is a name

But in tsearch when I am using to_tsvector, it gives as follows-

'iftekhar':4 'rumman':1 'solv':6 'went':2

postgres=# select to_tsvector('Rumman went to iftekhar to solve it') @@
to_tsquery('ifte') as c;
c
---
f
(1 row)

I am confused how to execute the above like operation in tsearch.

Any help please.

       Regards,
               Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83