Indexing Items and their metadata

My goal is to be able to add properties to an Item and/or Test (e.g.: Subject Matter, Grade Level, Difficulty, etc.) and then search against these properties.

I looked at the GenerisSearch and found that it only indexes an object's label and does not appear to index any of the properties. So I switched over to the Solr implementation and found that that will index and search against both labels and properties. However, it seems to only do this after I manually run the 'Reindex all resource' under the dev tools scripts. I found the SolariumSearch class has an unimplemented index() method, but I can't find it called anywhere.

Ideally, I'd imagine I would want this method implemented, and then added to the various edit methods of everything I'd like to index. But before I started down this path, I was hoping to check and make sure I was heading in the right direction, or if I'm missing another extension, or if someone has already implemented this.



  • Hi Leigh,

    You may run such command regularly to force reindexing:
    sudo -u www-data php [TAO_ROOT]/tao/scripts/taoIndexResources.php

    A cron job would be perfect for that purpose.


  • Hi,

    We're planning to implement an event based approach for the re-indexation, but I cannot provide you with a time-frame for this yet.

  • Joel,
    Can you provide more details on how that would work? I'm not familiar with the event based actions within TAO.

  • Hi,

    Please take a look at taoResourceWorkflow ( for a simple example:

    $this->registerEvent(ResourceCreated::class, [ResourceWorkflowService::SERVICE_ID, 'onCreate']);

    This line registers an event-listener that ensures that whenever the event "ResourceCreated" has been fired, the function "onCreate($event)" will be triggered on the service called "ResourceWorkflowService".

    If you are interested in this, you would need to add a "ResourceModified" event that gets triggered whenever a resource is modified. With these two events you could trigger a (re)indexaction of all resources that have been created or modified and you would no longer need to rely on the manual indexing.

    Please let me know if you are interested in implementing this.

  • Hi Joel,
    I think I'll definitely be interested in implementing something like this. I temporarily setup a cronjob, but honestly, that feels a little lazy. Plus, I'd like users to be able to search for items and tests immediately after they've been created.

Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy