Last updated by maurice 5 years ago

Searchable Plugin - Managing the index

Thanks to Compass::GPS the Searchable Plugin mirrors changes made through Hibernate/GORM to the index, and this means that you normally don't have to think about maintaining the index yourself.

But perhaps when an object is created/saved/updated/deleted with GORM/Hibernate is not when you want it to be indexed. Perhaps your application updates the DB with raw SQL or JDBC, which Compass::GPS isn't aware of, or there are other applications updating the DB. Maybe you don't like the mirroring feature and have disabled it (see Configuration).

In these cases you will need to maintain the index yourself, and Searchable Plugin provides a few methods to help with this.

Like the search methods, they come in SearchableService and searchable domain class varieties. The domain class methods restrict the operation to instances of that class (or hierarchy).

The methods are:

  • @index@ - Indexes searchable class instances (adds them to the search index
  • @unindex@ - Un-indexes searchable class instances (removes them from the search index)
  • @reindex@ - Re-indexes searchable class instances (refreshes them in the search index)
There are also a few @SearchableService@-only methods: