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

Collapse
Posted by Antonio Pisano on
Dear Iuri,

the place where "the magic happens" in the search package is this proc https://openacs.org/api-doc/proc-view?proc=search::indexer&source_p=1.

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.

Ciao
Antonio

Collapse
Posted by Iuri Sampaio on
Antonio,
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.

https://dashboard.qonteo.com/file-storage/view/E%cc%81pi%cc%82tre_de_la_mode%cc%81ration_en_%5b...%5dVoltaire_(1694-1778)_bpt6k6104957k.pdf

... and I've also created a Xowiki Page
https://dashboard.qonteo.com/xowiki/oacsforumthread

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

https://dashboard.qonteo.com/search/search?q=forum&search_package_id=442093&__csrf_token=C9C66423DAD97C33AF9A28377EECC7AC9CE1E212

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

Collapse
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

Collapse
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 https://pt.wikipedia.org/wiki/The_IT_Crowd