Last updated by maurice 5 years ago

reindex

Summary

Re-indexes searchable class instances (refreshes them in the search index)

Syntax

domainObject.reindex()

DomainClass.reindex()
DomainClass.reindex(DomainClass instances...)
DomainClass.reindex(Serializable ids...)

searchableService.reindex()
searchableService.reindex(Map options)
searchableService.reindex(DomainClass instances...)
searchableService.reindex(Serializable ids..)
searchableService.reindex(Map options, Serializable ids...)

Description

When called as a domain class instance method, re-indexes the instance.

When called as a domain class static method with no arguments, re-indexes all instances for that class (or hierarchy).

When called as a SearchableService method with no arguments, re-indexes all searchable class instances.

In other invocations, re-indexes the searchable class instances you provide or identify.

Parameters

  • @instances@ - One or more searchable class instances
  • @ids@ - One or more searchable class instance ids
  • @options@ - A Map of options

options

  • @class@ - a searchable class; use this option with the SearchableService method and ids parameter or as an alternative to the domain-class method

Returns

No meaningful value

Examples

// Reindex a Post instance
post.reindex()

// Add some Menus to the index
Menu.reindex(m1, m2)

// Add all Countries to the index
Country.reindex()

// Reindex everything
searchableService.reindex()

// Reindex the identified Book
searchableService.reindex(class: Book, 1l)

// Reindex the given Tool
searchableService.reindex(tool)