# Interface SearchProvider

Provides search capability for one or more data/FeatureSource!FeatureSources.

interface SearchProvider {
count(source: FeatureSource | FeatureSource[], searchText: string, options?: SearchOptions): Promise<CountResult[]>;
isSupported(source: FeatureSource): boolean;
search(source: FeatureSource | FeatureSource[], searchText: string, options?: SearchOptions): AsyncIterable<Feature, any, any>;
suggest(source: FeatureSource | FeatureSource[], searchText: string, options?: SearchOptions): Promise<SearchSuggestion[]>;
}

#### Implemented by

- SearchProviderBase

#####
Index

### Methods

count
isSupported
search
suggest

##
Methods

### count

- count(source, searchText, options?): Promise<CountResult[]>

- Searches a given feature source for features that match a search phrase and returns a count of matching features.

  #### Parameters

  - source: FeatureSource | FeatureSource[]

    The source to search.

  - searchText: string

    The text to search for.

  - `Optional` options: SearchOptions

    Options that affect the search.

  #### Returns Promise<CountResult[]>

  An iterator of tasks/CountResult!CountResults containing a count of matching features. If the search is canceled, the provider may reject the returned promise with an instance of support/Cancellable!Cancellation, though it may still fulfill with count results instead.

### isSupported

- isSupported(source): boolean

- Determines whether this provider can handle searches for the given feature source.

  #### Parameters

  - source: FeatureSource

    The feature source.

  #### Returns boolean

### search

- search(source, searchText, options?): AsyncIterable<Feature, any, any>

- Searches a given feature source for features that match a search phrase.

  #### Parameters

  - source: FeatureSource | FeatureSource[]

    The source to search.

  - searchText: string

    The text to search for.

  - `Optional` options: SearchOptions

    Options that affect the search.

  #### Returns AsyncIterable<Feature, any, any>

  An iterator of data/Feature!Features containing search results. If the search is canceled, the provider may reject the returned promise with an instance of support/Cancellable!Cancellation, though it may still fulfill with search results instead.

### suggest

- suggest(source, searchText, options?): Promise<SearchSuggestion[]>

- Suggests matching phrases to search for based on some input text.

  #### Parameters

  - source: FeatureSource | FeatureSource[]

    The source to search.

  - searchText: string

    The text to search for.

  - `Optional` options: SearchOptions

    Options that affect the search.

  #### Returns Promise<SearchSuggestion[]>

  A list of suggestions.