Upgrading InstantSearch Android
On this page
Upgrade event tracking
Starting from v3.2.0, InstantSearch makes it easier to send view events using the isAutoSendingHitsViewEvents
option on HitsSearcher
:
1
2
3
4
5
6
val searcher = HitsSearch(
applicationID = ApplicationID("YourApplicationID"),
apiKey = APIKey("YourSearchOnlyAPIKey"),
indexName = IndexName("indexName"),
isAutoSendingHitsViewEvents = true
)
From v3.2.0 to v3.3.0, this option was set to true
by default. Ensure you’re using the latest version of InstantSearch to send the required events.
Upgrade from InstantSearch v2 to v3
The library version 3.0
uses Kotlin 1.6
and Algolia Kotlin API Client 2.0
. Below are the steps to migrate.
This new version removes all deprecated methods and features from v2
.
InstantSearch Android package
InstantSearch Android package has changed. Update your imports accordingly:
Module | 2.x | 3.x |
---|---|---|
InstantSearch Android | com.algolia.instantsearch.helper.android |
com.algolia.instantsearch.android |
Kotlin API client
The Kotlin API client (and its underlying Ktor client) is part of the library’s binary interface. Read the migration guide, or apply the following changes:
LogLevel
The library uses LogLevel
from the Kotlin API client instead of Ktor’s Loglevel
:
Subsystem | 2.x | 3.x |
---|---|---|
LogLevel | io.ktor.client.features.logging.LogLevel |
com.algolia.search.logging.LogLevel |
Public constants
Constants (for example, KeyIndexName
, KeyEnglish
, and RouteIndexesV1
) aren’t exposed. Use your constants instead.
Ktor client
For more information, refer to Ktor’s migration guide.
Searchers
Legacy searchers are removed; please migrate as follows:
Searcher | 2.x | 3.x |
---|---|---|
Single Index Searcher | SearcherSingleIndex |
HitsSearcher |
Facets Searcher | SearcherForFacets |
FacetsSearcher |
Multi Index Searcher | SearcherMultipleIndex |
MultiSearcher |
Extension modules
Multiple extensions have been extracted to modules:
Subsystem | Module |
---|---|
Androidx SwipeRefreshLayout | com.algolia:instantsearch-android-loading |
Androidx Paging 3 | com.algolia:instantsearch-android-paging3 |
Androidx Paging 2 | Removed |
Upgrade from InstantSearch v1 to v2
InstantSearch v2 introduces a new architecture and new widgets, which brings several breaking changes from v1:
- No longer an
InstantSearch
component automatically connecting widgets. You are now in control of theSearcher
and responsible for connecting and disconnecting it from widgets and other components. - The widgets are now built around
ViewModel
s, holding their data and business logic.
Compared to the V1 where widgets were AndroidViews
, now the core of the widget is its view-model, and the UI is behind an interface to ensure minimal coupling.
You can learn more about the philosophy of InstantSearch v2 in What is InstantSearch. Once ready to start migrating, learn the steps to building an InstantSearch v2 app in the getting started guide..
The InstantSearch Android v1 documentation is available on the legacy docs page.