Forum OpenACS Development: Re: How to make an object type searchable?

Posted by Antonio Pisano on
Dear Iuri,

the place where "the magic happens" in the search package is this proc

This gets scheduled to run every minute or so (configurable) and will loop through entries in the search_observer_queue table which are supposedly created by a trigger existing on cr_items table and called "content_item_search__utrg" (Object types that do not inherit from cr_items can define a similar trigger on their own).

For each such entry, the callback you have registered should be called and return some indexable text representation of your document that is then processed by the FTS engine.

To try to debug your situation, try adding searchable documents to your websites (e.g. file-storage pdfs, xowiki pages and so on) and check:
- that upon creation, an entry in search_observer_queue is created (note that it will be deleted as soon as search::indexer is run, unless something goes wrong)
- put some debug statements in search::indexer and in your callback, to check that your item made it to the processing and your indexing callback was executed

If this does not help, we should have a look to your service-contract definition.


Posted by Iuri Sampaio on
Avoiding the possibility of errors in my custom code, I used FS and Xowiki packages to evaluate searching macanism. That way, we also exclude potential errors in the service-contract definition.

I've created the FS-file object (i.e. a PDF file) Nice reading btw! Voltaire's master piece.

... and I've also created a Xowiki Page

Then, I've tried to search for both items, but no results were returned.

Thus, neither a file nor a xowiki page is searchable.
i. I did wait for a couple of hours, and searched again, to make sure there's was engough time to reindex procedures.
ii. I did reboot NS.

Furthemore, there is no need to create extra step to make search observer aware, beucase new object types are "subtypes" of content revision.

OACS kernel is 5.9.2d2

At first my intuition were pointing to Tsearch2 Driver or PostgreSQL level. However, everything works just fine in the other instance, which is using the same RDBMS, same server even

Posted by Iuri Sampaio on
I've uninstalled and installed search package again, and now both items file object and xowiki page returned in the search.

I have no idea why neither how. I had ony reinstalled search pkg. That's all info I have.

Now, I'm going to debug custom objects... i'll paste the result here later on

Posted by Iuri Sampaio on
... reinstalling search pkg, means the same as...
"Have you try to turn off and turn on again?"
The famous jargon from IT Crowd