Forum OpenACS Development: Problem with searching "Static Pages"

Collapse
Posted by Ola Hansson on
The Static Pages package used to be searchable but now, after having upgraded my 4.5b site to openacs-5-0-compat, I find that it is not so ...

Assuming that it has nothing to do with the upgrade per se, and before I start to dig deeper, I was wondering if someone has knowledge about what is going on.

I first thougt it had to do with dropping the old openfts driver (0.2) and initializing the new (0.3.2), and I decided to stuff the search_observer_queue asking the search indexer to reindex the pages:

insert into search_observer_queue (select static_page_id, now(), 'UPDATE' from static_pages);
Nothing happened when the scheduled search indexer ran every 30 seconds.

Then I noticed that the object type returned from "set object_type [acs_object_type $object_id]" for one of my enqueued static pages returned "content_item" as opposed to "static_page" as I'd anticipated. I believe this must have changed in recent years. 😊

The thing is that the service contract implementation for the FtsContentProvider service contract defined in Static Pages uses the implementation name "static_page", the same name as the "static_page" object_type which is actually defined. The search_indexer proc only calls the service contract "if {[acs_sc_binding_exists_p FtsContentProvider $object_type]} {" and since the returned object_type (content_item) doesn't match the anticipated "static_page" there isn't much truth in this condition. And even if it did evaluate true in this case the subsequent call to "array set datasource [acs_sc_call FtsContentProvider datasource [list $object_id] $object_type]" would have done the wrong thing, I suspect ...

If anyone has something to say about this before I dig further into it that would be swell.

/Ola

Collapse
Posted by Ola Hansson on
I just wanted to report that it worked perfectly once I dropped and recreated the search_observer_queue with the new timestamptz datatype AND once I populated the queue with the proper page *revisions* instead of page *items* as I did before.

BTW, I committed some changes to the search triggers in the CR so that deleted and edited static pages get unindexed/reindexed. All in all, though, the triggers act kind of mysteriously in some cases and sometimes insert duplicate 'INSERT' or 'UPDATE' or 'DELETE' tuples into the queue. But I haven't noticed any immediate ill effects from that ... I tested ETP and it too seemed to work after the changes (knock wood).