SearchIndex class

Multi-language search index for settings.

The SearchIndex indexes settings by:

  1. The setting key
  2. Search terms defined in SettingDefinition.searchTerms (all languages)
  3. Translated titles/subtitles from the localization provider (all locales)
  4. Translated section titles for the setting's section (all locales)

This allows users to search in any language, regardless of the current UI language.

Example:

final index = SearchIndex(
  registry: registry,
  localizationProvider: PreIndexedLocalizationProvider({...}),
);
await index.build();

final results = index.search('dark'); // Finds 'theme' setting
final results2 = index.search('داكن'); // Also finds 'theme' setting (Arabic)

Constructors

SearchIndex({required SettingsRegistry registry, LocalizationProvider? localizationProvider})
Create a new search index.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isBuilt → bool
Whether the index has been built.
no setter
localizationProvider → LocalizationProvider?
The localization provider.
final
registry → SettingsRegistry
The settings registry.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stats → Map<String, int>
Get statistics about the index.
no setter

Methods

build() → Future<void>
Build the search index.
clear() → void
Clear the index.
getTermsForSetting(String settingKey) → Set<String>
Get all indexed terms for a setting.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rebuild() → Future<void>
Rebuild the index.
Search for settings matching the query.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited