in last 10 minutes
OACS Forum Thread
Forum OpenACS Development: How to make an object type searchable?
Posted by Iuri Sampaio on 08/02/20 10:11 PM
In order to make a new custom content_type search-able, I've followed the guidelines (i.e. available at: https://openacs.org/doc/search/guidelines), to write custom service contracts to those new custom content_types.
Then, I manually ran SQL scripts (i.e. acs_sc_impl_alias__new... ), and restarted NS. However, those new custom content items are still not search-able.
Those custom content_types use the content repository to store its items, and have content_revision as their super type, defined at the moment of the package installation and its data-model creation. (i.e. SQL content_type__create_type ...please read psql function below)
I've double-checked the service contracts and they were properly installed as FtsContentProvider.
However, custom items are still not search-able
What am I missing?
Furthermore, I tested file-storage package items, and they are not search-able either, in this OACS instance.
Instance 1 (search is broken): https://dashboard.qonteo.com/search/
Although, I have another OACS instance, which lars-blogger package is installed, and the search engine works just fine and returns the blog entries, searched by keywords.
Instance 2 (search works fine with lars-blogger):
select content_type__create_type ( 'qt_face', -- content_type 'content_revision', -- supertype. We search revision content -- first, before item metadata 'Qonteo Face', -- pretty_name 'Qonteo Faces', -- pretty_plural NULL, -- table_name -- IURI: acs_object_types supports a null table name so we do that -- instead of passing a false value so we can actually use the -- content repository instead of duplicating all the code in file-storage NULL, -- id_column 'qt_face__get_title' -- name_method );
Posted by Antonio Pisano on 08/04/20 07:16 AM
the place where "the magic happens" in the search package is this proc http://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.