postgres, adapter - full text search

Posts   
 
    
miloszes
User
Posts: 222
Joined: 03-Apr-2007
# Posted on: 04-May-2010 11:51:27   

Hi all,

How can I create a following query?

SELECT title FROM pgweb WHERE fts @@ to_tsquery('friend');

I'm wondering how to achieve an @@ operator.

Kind Regards, MiloszeS

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 04-May-2010 12:38:03   

What does this operator do?

miloszes
User
Posts: 222
Joined: 03-Apr-2007
# Posted on: 04-May-2010 12:57:31   

It searches a vector for a specified elements. Something like Contains.

Ex:

The fts column contains a collection of words:

1) "LLBLGen", "Pro" 2) "LLBLGen", "ORM"

If we declare a following clause:

WHERE fts @@ to_tsquery('LLBLGen');

It'll search all rows containing LLBLGen word.

It's only my ween about the operator meaning - hope I'm not wrong wink . More info can be found in the documentation:

http://204.145.120.225/docs/8.4/interactive/textsearch-tables.html#TEXTSEARCH-TABLES-INDEX

Regards, MiloszeS

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 04-May-2010 13:16:33   

You will need to create a custom predicate for this. You can start by deriving from FieldLikePredicate and override the ToQueryText method to produce @@ instead of LIKE.

miloszes
User
Posts: 222
Joined: 03-Apr-2007
# Posted on: 04-May-2010 18:46:42   

Ok, works perfect.

Thanks for a help. Regards, MiloszeS