SearchWidget constructor
SearchWidget(- 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,
- 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 execute,
- bool enableSynonyms,
- String selectAllLabel,
- bool queryString,
- Map defaultQuery(
- SearchWidget searchWidget
),
- Map customQuery(
- SearchWidget searchWidget
),
- Future beforeValueChange(
- String 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(
- Error error
),
- void onRequestStatusChange(
- String next,
- {String prev}
),
- void onQueryChange(
- Map next,
- {Map prev}
),
- bool enablePopularSuggestions,
- int maxPopularSuggestions,
- bool showDistinctSuggestions,
- bool preserveResults,
- dynamic value,
- List<Map> results}
)
Implementation
SearchWidget(
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.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.execute,
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.value,
List<Map> results,
}) : super(index, url, credentials,
appbaseConfig: appbaseConfig,
transformRequest: transformRequest,
transformResponse: transformResponse,
headers: headers) {
if (id == "") {
throw (ErrorMessages[InvalidComponentId]);
}
// dataField is required for components other then search
if (type != null && type != QueryType.search) {
if (dataField == null) {
throw (ErrorMessages[InvalidDataField]);
} else if (dataField is List<String>) {
throw (ErrorMessages[DataFieldAsArray]);
}
}
// Initialize the state changes observable
this.stateChanges = new Observable();
this.results = new Results(results != null ? results : []);
this.aggregationData = new Aggregations(data: []);
if (value != null) {
this.setValue(value, options: new Options());
} else {
this.value = value;
}
}