reset password
Author Message
avdhesh
Posts: 3
Posted 20:24 May 26, 2009 |

Hi Professor,

Running following query in postgres returns empty table where content field has date containing word 'for'

select * from blogentries where to_tsvector(title||contents) @@ to_tsquery('for')


What am I missing here?

shahana
Posts: 11
Posted 20:50 May 26, 2009 |

I think your query should be something like this 

select * from tablename where to_tsvector(columnname) @@ to_tsquery('query')

 OR to_tsvector(columnname) @@ to_tsquery('query')

 

The video which Dr. Sun posted highlights few such cases and is very helpful.

 

 

cysun
Posts: 2935
Posted 21:00 May 26, 2009 |
avdhesh wrote:

Hi Professor,

Running following query in postgres returns empty table where content field has date containing word 'for'

select * from blogentries where to_tsvector(title||contents) @@ to_tsquery('for')


What am I missing here?

"for" is a stop word and is probably removed after to_tsvector(). To verify, try something like select ts_tsvector(title || content) from blogentries and see what's there.

Last edited by cysun at 21:00 May 26, 2009.