Reference Source
import SearchSource from 'flarum/components/SearchSource'
public interface | source

SearchSource

The SearchSource interface defines a section of search results in the search dropdown.

Search sources should be registered with the Search component instance (app.search) by extending the sourceItems method. When the user types a query, each search source will be prompted to load search results via the search method. When the dropdown is redrawn, it will be constructed by putting together the output from the view method of each source.

Method Summary

Public Methods
public

search(query: String): Promise

Make a request to get results for the given query.

public

view(query: String): Object

Get an array of virtual

  • s that list the search results for the given query.
  • Public Methods

    Make a request to get results for the given query.

    Params:

    NameTypeAttributeDescription
    query String

    Return:

    Promise

    public view(query: String): Object source

    Get an array of virtual

  • s that list the search results for the given query.
  • Params:

    NameTypeAttributeDescription
    query String

    Return:

    Object