The library version 4.0 uses Kotlin version 2.2 and Algolia Kotlin API Client 3.37. Below are the steps to migrate.
InstantSearch Android 4.x has updated minimum requirements:
| Requirement | 3.x | 4.x |
|---|---|---|
| Kotlin | 1.9+ | 2.2+ |
| Android minSdk | 21 | 23 |
| Android compileSdk | 33 | 35 |
| Ktor | 2.3 | 3.3 |
| Algolia Client | 2.x | 3.x |
The Algolia Kotlin API Client has been upgraded from version 2.x to 3.x. This is a major version upgrade with significant changes.
Some classes may have moved to different packages. Update your imports accordingly.
The primitive wrapper data classes have been removed:
Attribute- UseStringdirectlyObjectID- UseStringdirectlyAppID- UseStringdirectly
Before (3.x):
val objectID = ObjectID("my-object-id")
val attribute = Attribute("category")After (4.x):
val objectID = "my-object-id"
val attribute = "category"Some API methods and response structures have changed. Refer to the Algolia Kotlin Client 3.x documentation for details.
The Answers feature has been removed as it's no longer supported by Algolia. If you were using SearcherAnswers, you'll need to migrate to alternative search approaches:
Removed:
SearcherAnswersclassSearcherAnswersfilter-state connection- Related telemetry hooks
The Places feature has been deprecated and removed. Please refer to Algolia Places migration guide for alternatives.
The Insights implementation has been updated to use v3 events:
- HTTP repository now sends events via
pushEventsAPI - Filter strings are now parsed into stored filters
- Automatic hits view tracking uses v3 event format
- Facet list tracing now uses
FacetHitsinstead of older structures - Facets search now serializes
SearchParamsObjectintoparamsfor SearchForFacetValues requests
If you're updating your project, make sure to update related dependencies:
// Update Kotlin
kotlin = "2.2.0"
// Update Algolia Client
implementation "com.algolia:algoliasearch-client-kotlin:3.37.2"
// Update Ktor if using directly
ktor = "3.3.3"
// Update Compose if using
androidx.compose.ui = "1.10.0"- Update dependencies in your
build.gradleorgradle/libs.versions.toml - Update minimum SDK version to 23 in your
build.gradle - Remove wrapper classes: Replace
ObjectID,Attribute,AppIDwithString - Remove Answers usage: If using
SearcherAnswers, migrate to standard search - Remove Places usage: If using
SearcherPlaces, migrate to alternative geo-search solutions - Update API calls: Review and update any direct Algolia API client calls according to client 3.x changes
- Test thoroughly: The new versions include significant internal changes, so comprehensive testing is recommended
For more details on specific changes, refer to the CHANGELOG.