Last updated by maurice 5 years ago

rebuildSpellingSuggestions

Summary

Re-builds the spelling suggestions index

Syntax

searchableService.rebuildSpellingSuggestions()
searchableService.rebuildSpellingSuggestions(options)

Description

A spelling suggestions index is required to use query suggestions.

This method allows you to re-build the spelling suggestions index(es) on demand.

The spelling suggestions feature is provided by Compass and normally takes care of itself. In other words, you do not need to re-build the spelling index in normal circumstances.

However it may be useful in certain scenarios, eg, in tests.

Parameters

Options

  • @fork@ - If @true@, forks a new thread and returns immediately. May not be used with @subIndex@. Default is @false@, in which case the method only returns when the re-build is finished
  • @subIndex@ - The sub-index of a searchable class to re-build the spelling suggestions for. May not be used with @fork@. Default is to re-build the spelling suggestions indexes for all classes.

Examples

// Rebuild in a backgroudn thread
searchableService.rebuildSpellingSuggestions(fork: true)

// Rebuild for just one sub-index (maps to one class hierarchy)
searchableService.rebuildSpellingSuggestions(subIndex: "House")