SearchBase class

The SearchBase class holds the state for all the active SearchController and can be used to provide the global configuration to the registered SearchController.

It serves the following tasks:

  • To register a SearchController by unique id
  • To unregister a SearchController by id
  • To retrieve the instance of the SearchController class by id
  • To provide an ability to watch registered widget reactively with the help of the react property.

Note:

  1. The id property is a unique identifier to each search widget.
  2. The SearchBase class is useful when you're using multiple search widgets that depend on each other. For example, a filter widget (to display the category options) depends on the search query (search widget). If you're only using a single widget then SearchController class should work well.

Constructors

SearchBase(String index, String url, String credentials, {AppbaseSettings? appbaseConfig, TransformRequest? transformRequest, TransformResponse? transformResponse, Map<String, String>? headers})

Properties

appbaseConfig AppbaseSettings?
It allows you to customize the analytics experience when appbase.io is used as a backend.
getter/setter pairinherited
credentials String
Basic Auth credentials if required for authentication purposes.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Set custom headers to be sent with each server request as key/value pairs.
getter/setter pairinherited
index String
Refers to an index of the Elasticsearch cluster.
getter/setter pairinherited
queryId String?
To get the query ID
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
transformRequest TransformRequest?
Enables transformation of network request before execution.
getter/setter pairinherited
transformResponse TransformResponse?
Enables transformation of search network response before rendering them.
getter/setter pairinherited
url String
URL for the Elasticsearch cluster.
getter/setter pairinherited

Methods

click(Map<String, int> objects, {bool isSuggestionClick = false, String? queryId}) Future
use this methods to record a search click event
inherited
conversion(List<String> objects, {String? queryId}) Future
use this methods to record a search conversion
inherited
getActiveWidgets() Map<String, SearchController>
This method returns all the active widgets registered on the SearchBase instance.
getSearchWidget(String widgetId) SearchController?
This method can be used to retrieve the instance of the SearchController class for a particular widget by id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(String widgetId, dynamic searchController) SearchController
This method can be used to register a search widget with a unique id.
setHeaders(Map<String, String> headers) → void
To to set the custom headers
inherited
setQueryID(String queryID) → void
To set the query ID
inherited
toString() String
A string representation of this object.
inherited
unregister(String widgetId) → void
This method is useful to unregister a SearchController by id.

Operators

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