SearchController(- String index,
- String url,
- String credentials,
- String id,
- {AppbaseSettings? appbaseConfig,
- TransformRequest? transformRequest,
- TransformResponse? transformResponse,
- QueryType? type,
- Map<String, dynamic>? react,
- String? queryFormat,
- dynamic dataField,
- String? categoryField,
- String? categoryValue,
- String? nestedField,
- int? from,
- int? size,
- SortType? sortBy,
- String? aggregationField,
- int? aggregationSize,
- Map? after,
- bool? includeNullValues,
- List<String>? includeFields,
- List<String>? excludeFields,
- dynamic fuzziness,
- bool? searchOperators,
- bool? highlight,
- dynamic highlightField,
- Map? customHighlight,
- int? interval,
- List<String>? aggregations,
- String? missingLabel,
- bool? showMissing,
- bool? enableSynonyms,
- String? selectAllLabel,
- bool? queryString,
- Map defaultQuery(
- SearchController searchController
)?,
- Map customQuery(
- SearchController searchController
)?,
- Future beforeValueChange(
- dynamic value
)?,
- void onValueChange(
- String? next,
- {String? prev}
)?,
- void onResults(
- List<Map>? next,
- {List<Map>? prev}
)?,
- void onAggregationData(
- List<Map>? next,
- {List<Map>? prev}
)?,
- void onError(
- dynamic error
)?,
- void onRequestStatusChange(
- String? next,
- {String? prev}
)?,
- void onQueryChange(
- Map? next,
- {Map? prev}
)?,
- bool? enablePopularSuggestions,
- int? maxPopularSuggestions,
- bool? showDistinctSuggestions,
- bool? preserveResults,
- String? distinctField,
- Map? distinctFieldConfig,
- dynamic value,
- bool clearOnQueryChange = false,
- List<Map>? results}
)
Implementation
SearchController(
String index,
String url,
String credentials,
String this.id, {
AppbaseSettings? appbaseConfig,
TransformRequest? transformRequest,
TransformResponse? transformResponse,
Map<String, String>? headers,
this.type,
this.react,
this.queryFormat,
this.dataField,
this.categoryField,
this.categoryValue,
this.nestedField,
this.from,
this.size,
this.sortBy,
this.aggregationField,
this.aggregationSize,
this.after,
this.includeNullValues,
this.includeFields,
this.excludeFields,
this.fuzziness,
this.searchOperators,
this.highlight,
this.highlightField,
this.customHighlight,
this.interval,
this.aggregations,
this.missingLabel,
this.showMissing,
this.enableSynonyms,
this.selectAllLabel,
this.pagination,
this.queryString,
this.defaultQuery,
this.customQuery,
this.beforeValueChange,
this.onValueChange,
this.onResults,
this.onAggregationData,
this.onError,
this.onRequestStatusChange,
this.onQueryChange,
// this.onMicStatusChange,
this.enablePopularSuggestions,
this.maxPopularSuggestions,
this.showDistinctSuggestions,
this.preserveResults,
this.distinctField,
this.distinctFieldConfig,
this.value,
this.clearOnQueryChange = false,
List<Map>? results,
}) : super(index, url, credentials,
appbaseConfig: appbaseConfig,
transformRequest: transformRequest,
transformResponse: transformResponse,
headers: headers) {
if (id == "") {
throw (ErrorMessages[InvalidComponentId]);
}
// dataField can't be an array for queries other than search
if (type != null && type != QueryType.search && dataField is List<String>) {
throw (ErrorMessages[DataFieldAsArray]);
}
// Initialize the state changes observable
this.stateChanges = new Observable();
this.results = new Results(
results != null ? results as List<Map<String, dynamic>> : []);
this.aggregationData = new Aggregations(data: []);
if (value != null) {
this.setValue(value, options: new Options());
} else {
this.value = value;
}
}