SearchState class

Represents a search operation state, and an abstraction over search queries.

Example

const searchState = SearchState(
  indexName: 'MY_INDEX_NAME',
  query: 'shoes',
  page: 1,
  hitsPerPage: 20,
  attributesToRetrieve: ['name', 'description', 'price'],
);
Implemented types

Constructors

SearchState({required String indexName, bool? analytics, List<String>? attributesToHighlight, List<String>? attributesToRetrieve, List<String>? attributesToSnippet, Set<String>? disjunctiveFacets, bool isDisjunctiveFacetingEnabled = true, List<String>? facetFilters, List<String>? facets, Set<FilterGroup<Filter>>? filterGroups, String? highlightPostTag, String? highlightPreTag, int? hitsPerPage, int? maxFacetHits, int? maxValuesPerFacet, List<String>? numericFilters, List<String>? optionalFilters, int? page, String? query, List<String>? ruleContexts, bool? sumOrFiltersScore, List<String>? tagFilters, String? userToken, bool? clickAnalytics, bool? aroundLatLngViaIP, String? aroundLatLng, dynamic aroundRadius, int? minimumAroundRadius, int? aroundPrecision, List<List<double>>? insideBoundingBox})
Creates SearchState instance.
const

Properties

analytics bool?
Whether the current query will be taken into account in the Analytics.
final
aroundLatLng String?
AroundLatLng
final
aroundLatLngViaIP bool?
AroundLatLngViaIP
final
aroundPrecision int?
AroundPrecision
final
aroundRadius → dynamic
AroundRadius
final
attributesToHighlight List<String>?
List of attributes to highlight.
final
attributesToRetrieve List<String>?
Gives control over which attributes to retrieve and which not to retrieve.
final
attributesToSnippet List<String>?
List of attributes to snippet, with an optional maximum number of words to snippet.
final
clickAnalytics bool?
Add a query ID parameter to the response for tracking click and conversion events.
final
disjunctiveFacets Set<String>?
Disjunctive facets list
final
facetFilters List<String>?
Filter hits by facet value.
final
facets List<String>?
Search facets list
final
filterGroups Set<FilterGroup<Filter>>?
Set of filter groups
final
hashCode int
The hash code for this object.
no setteroverride
highlightPostTag String?
The HTML name to insert after the highlighted parts in all highlight and snippet results.
final
highlightPreTag String?
The HTML name to insert before the highlighted parts in all highlight and snippet results.
final
hitsPerPage int?
Number of hits per page
final
indexName String
Index name
final
insideBoundingBox List<List<double>>?
InsideBoundingBox
final
isDisjunctiveFacetingEnabled bool
Whether disjunctive faceting is enabled
final
maxFacetHits int?
Maximum number of facet hits to return during a search for facet values.
final
maxValuesPerFacet int?
Maximum number of facet values to return for each facet during a regular search.
final
minimumAroundRadius int?
MinimumAroundRadius
final
numericFilters List<String>?
Filter on numeric attributes.
final
optionalFilters List<String>?
Create filters for ranking purposes, where records that match the filter are ranked highest.
final
page int?
Search page number
final
query String?
Search query string
final
ruleContexts List<String>?
Search rule contexts
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sumOrFiltersScore bool?
Determines how to calculate the total score for filtering.
final
tagFilters List<String>?
Filter hits by tags.
final
userToken String?
Associates a certain user token with the current search.
final

Methods

copyWith({List<String>? attributesToHighlight, List<String>? attributesToRetrieve, List<String>? attributesToSnippet, List<String>? facetFilters, List<String>? facets, List<String>? numericFilters, List<String>? optionalFilters, List<String>? ruleContexts, List<String>? tagFilters, Set<FilterGroup<Filter>>? filterGroups, Set<String>? disjunctiveFacets, bool? isDisjunctiveFacetingEnabled, String? highlightPostTag, String? highlightPreTag, String? indexName, String? query, String? userToken, bool? analytics, bool? sumOrFiltersScore, int? hitsPerPage, int? maxFacetHits, int? maxValuesPerFacet, int? page, bool? clickAnalytics, bool? aroundLatLngViaIP, String? aroundLatLng, dynamic aroundRadius, int? aroundPrecision, int? minimumAroundRadius, List<List<double>>? insideBoundingBox}) SearchState
Make a copy of the search state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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