SearchWidget constructor

SearchWidget(
  1. String index,
  2. String url,
  3. String credentials,
  4. String id,
  5. {AppbaseSettings appbaseConfig,
  6. TransformRequest transformRequest,
  7. TransformResponse transformResponse,
  8. Map<String, String> headers,
  9. QueryType type,
  10. Map<String, dynamic> react,
  11. String queryFormat,
  12. dynamic dataField,
  13. String categoryField,
  14. String categoryValue,
  15. String nestedField,
  16. int from,
  17. int size,
  18. SortType sortBy,
  19. String aggregationField,
  20. Map after,
  21. bool includeNullValues,
  22. List<String> includeFields,
  23. List<String> excludeFields,
  24. dynamic fuzziness,
  25. bool searchOperators,
  26. bool highlight,
  27. dynamic highlightField,
  28. Map customHighlight,
  29. int interval,
  30. List<String> aggregations,
  31. String missingLabel,
  32. bool showMissing,
  33. bool execute,
  34. bool enableSynonyms,
  35. String selectAllLabel,
  36. bool pagination,
  37. bool queryString,
  38. Map defaultQuery(
    1. SearchWidget searchWidget
    ),
  39. Map customQuery(
    1. SearchWidget searchWidget
    ),
  40. Future beforeValueChange(
    1. String value
    ),
  41. void onValueChange(
    1. String next,
    2. {String prev}
    ),
  42. void onResults(
    1. List<Map> next,
    2. {List<Map> prev}
    ),
  43. void onAggregationData(
    1. List<Map> next,
    2. {List<Map> prev}
    ),
  44. void onError(
    1. Error error
    ),
  45. void onRequestStatusChange(
    1. String next,
    2. {String prev}
    ),
  46. void onQueryChange(
    1. Map next,
    2. {Map prev}
    ),
  47. bool enablePopularSuggestions,
  48. int maxPopularSuggestions,
  49. bool showDistinctSuggestions,
  50. bool preserveResults,
  51. dynamic value,
  52. 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;
  }
}