Unix Technical Forum

tsearch2: rebuilding of fulltext index

This is a discussion on tsearch2: rebuilding of fulltext index within the pgsql Novice forums, part of the PostgreSQL category; --> hi list is there an easy way to enforce a full rebuild of a tsearch2 index? as the index ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 10:37 PM
me@alternize.com
 
Posts: n/a
Default tsearch2: rebuilding of fulltext index

hi list

is there an easy way to enforce a full rebuild of a tsearch2 index? as the index is not really a pgsql index but rather an additional field in a record, REINDEX doesn't seem to do the job...

thanks,
thomas
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 10:37 PM
Michael Fuhr
 
Posts: n/a
Default Re: tsearch2: rebuilding of fulltext index

On Sat, Feb 25, 2006 at 07:26:07PM +0100, me@alternize.com wrote:
> is there an easy way to enforce a full rebuild of a tsearch2
> index? as the index is not really a pgsql index but rather an
> additional field in a record, REINDEX doesn't seem to do the job...


What do you mean by "doesn't seem to do the job"? What are you
wanting to happen and what actually is happening? What's the purpose
of what you're calling a "full rebuild"?

Maybe what you're after is a full-table update that will cause the
tsearch2 trigger to fire for every row and regenerate the tsvector.
Something like this:

UPDATE foo SET id = id;

This assumes that you have a tsearch2 trigger on the table. Do
you? Or have I misunderstood what you're trying to do?

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 10:37 PM
me@alternize.com
 
Posts: n/a
Default Re: tsearch2: rebuilding of fulltext index

> On Sat, Feb 25, 2006 at 07:26:07PM +0100, me@alternize.com wrote:
>> is there an easy way to enforce a full rebuild of a tsearch2
>> index? as the index is not really a pgsql index but rather an
>> additional field in a record, REINDEX doesn't seem to do the job...

>
> What do you mean by "doesn't seem to do the job"? What are you
> wanting to happen and what actually is happening? What's the purpose
> of what you're calling a "full rebuild"?


we have a discussion board whose posts should be indexed by tsearch2. now it
came to our attention, that not all posts seem to be properly indexed (why
so i do not know yet). as i don't know which posts are not index, i just
want to reindex all of them.

> Maybe what you're after is a full-table update that will cause the
> tsearch2 trigger to fire for every row and regenerate the tsvector.
> Something like this:
>
> UPDATE foo SET id = id;
>
> This assumes that you have a tsearch2 trigger on the table. Do
> you? Or have I misunderstood what you're trying to do?


that probably work, i was wondering tho if there was a "native" tsearch2
update function that could be used just like a REINDEX; without actually
having to use UPATE.

thanks,
thomas



---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-17-2008, 10:38 PM
Michael Fuhr
 
Posts: n/a
Default Re: tsearch2: rebuilding of fulltext index

On Sat, Feb 25, 2006 at 08:03:41PM +0100, me@alternize.com wrote:
> we have a discussion board whose posts should be indexed by tsearch2. now
> it came to our attention, that not all posts seem to be properly indexed
> (why so i do not know yet). as i don't know which posts are not index, i
> just want to reindex all of them.


How do the posts "seem not to be properly indexed"? What did you
do, what did you expect to happen, and what did happen? Let's see
if we can identify the problem before trying to solve it.

Are queries not returning messages that you'd expect them to? If
so then could you post one such query and the row that it should
match but didn't (or did match but shouldn't)? If that's not the
case then how did you discover the problem? What unexpected behavior
are you seeing?

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2008, 10:38 PM
me@alternize.com
 
Posts: n/a
Default Re: tsearch2: rebuilding of fulltext index

> On Sat, Feb 25, 2006 at 08:03:41PM +0100, me@alternize.com wrote:
>> we have a discussion board whose posts should be indexed by tsearch2. now
>> it came to our attention, that not all posts seem to be properly indexed
>> (why so i do not know yet). as i don't know which posts are not index, i
>> just want to reindex all of them.

>
> How do the posts "seem not to be properly indexed"? What did you
> do, what did you expect to happen, and what did happen? Let's see
> if we can identify the problem before trying to solve it.



already solved - programming error. for tsearch2 we stripe the board message
from html codes for better search results. INSERT did not properly set this
text in auto-generated board topics (we have some content for which board
messages are system-generated).

> Are queries not returning messages that you'd expect them to? If
> so then could you post one such query and the row that it should
> match but didn't (or did match but shouldn't)? If that's not the
> case then how did you discover the problem? What unexpected behavior
> are you seeing?



everything is fine now after fixing the INSERT and doing a dummy UPDATE on
all posts. thanks for your help!

- thomas



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:27 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com