Forum OpenACS Q&A: Reindexing Search?

Collapse
Posted by Aernout Schmidt on
I screwed up my search index (tsearch2, postgres), presumably through backup-recovery testing. Is there a way to reindex the whole site? (I thought of de- and reinstalling Search, but got warned out of the idea.)
Collapse
2: Re: Reindexing Search? (response to 1)
Posted by Claudio Pasolini on
You have to rebuild the search_observer_queue table with pointers to your contents. I once used the following queries (I don't remember who posted them on the forum).

To reindex edit-this-page contents:

   insert into search_observer_queue (
       select revision_id, current_timestamp, 'INSERT'
       from cr_revisions r, cr_items i
       where r.item_id = i.item_id and
             i.content_type = 'etp_page_revision' and
             r.revision_id = i.live_revision);
To reindex file-storage contents:
 insert into search_observer_queue (
       select revision_id, current_timestamp, 'INSERT'
   from cr_revisions r, cr_items i
   where r.item_id = i.item_id and
         i.content_type = 'file_storage_object' and
         r.revision_id = i.live_revision and
         (mime_type = 'application/pdf' or
          mime_type = 'application/msword' or
          mime_type = 'application/vnd.ms-word' or
          mime_type = 'application/excel' or
          mime_type = 'application/vnd.ms-excel' or
          mime_type like 'text/%'));
To reindex news contents:
   insert into search_observer_queue (
       select revision_id, current_timestamp, 'INSERT'
       from cr_revisions r, cr_items i
       where r.item_id = i.item_id and
             i.content_type = 'news' and
             r.revision_id = i.live_revision);
Hope this helps.
Collapse
3: Re: Reindexing Search? (response to 1)
Posted by Aernout Schmidt on
Thanks, Claudio. Now my level of OpenACS progamming knowledge and -architecture understanding is practically zero, (I have stopped programming in Fortran and Prolog several decades ago) so the question may be silly. Still: would it make sense to write a 'reindexing search' package? And would it make sense to have a go at that from my knowledge base (and additional working with developer docs) and rather limited time resources? Can someone more knowledgeble give a hint? And would he or she be willing to guide me through the process?
Collapse
4: Re: Reindexing Search? (response to 1)
Posted by Dave Bauer on
The search package on HEAD supports reindexing of seachable object types. I am nore sure if its tested on PostgreSQL but it works for Oracle.
Collapse
5: Re: Re: Reindexing Search? (response to 4)
Posted by Aernout Schmidt on
I will try the HEAD package tonight and report on the results. Thanks, Dave.
Collapse
Posted by Aernout Schmidt on
The HEAD package I found tells me it is oder than the one I installed? Version of my search package says 5.2.2. and reports to be newer than the 5.2.0.. version in HEAD.