Releases: typesense/typesense-swift
v1.0.1
v1.0.1-rc.1
What's Changed
- feat: add conversation API & doc: update README API documentation by @phiHero in #38
- fix: type
conversationHistory
should be an array & integer parameters incorrectly converted to boolean by @phiHero in #39
Full Changelog: v1.0.0...v1.0.0-rc.1
v1.0.0
This new version has some major improvements and some breaking changes as a result.
Please read through the following changelog if you're upgrading from an older version.
What's Changed
- [Breaking Change] Allow search grouping of multiple fields with different data type using AnyCodable. #35
// type of num_employees is Int, country is String and metadata is Boolean
// before, if we try grouping these fields together, Swift will throw a decoding error
let searchParams = SearchParameters(q: "*", queryBy: "company_name", groupBy: "num_employees,country,metadata")
let (data, _) = try await client.collection(name: "companies").documents().search(searchParams, for: Company.self)
if let groupKey = data?.groupedHits?.first?.groupKey{
if let num_employees = groupKey[0].value as? Int{
print(num_employees)
}
// do the same for country and metadata
}
- [Breaking Change] All endpoints will now throw
HTTPError.clientError
andHTTPError.serverError
.
do {
let (data, _) = try await client.keys().retrieve(id: 1)
// all endpoints will now throw HTTPError client & server error
} catch HTTPError.clientError(let code, let desc){
print(code, desc)
} catch HTTPError.serverError(let code, let desc){
print(code, desc)
// instead of ResponseError
// catch ResponseError.apiKeyNotFound(let desc) {
// print(desc)
// }
} catch (let error) {
print(error)
}
- [Breaking Change] Update analytics rules schemas
// the `type` field is now an enum
AnalyticsRuleSchema(
name: "product_queries_aggregation",
type: .popularQueries,
// type: "popular_queries",
)
- [Breaking Change] The
_id
field ofApiKey
model is now required.
Features:
- Added Presets, Stopwords, Overrides, Analytics Events, Operation Debug and Operation Clear Cache endpoints.
- Updated multiple endpoints to the latest parameters and schemas.
- Allow configuration of dirty data behaviors, import actions and export options.
- Allow multi-search and single collection search to return raw data
- Add support for Node URL. #34
Fixes:
- Nodes health state isn't in sync. #35
- Multiple new instances of ApiCall still use the same
currentNodeIndex
. - Analytic methods weren't made public.
- Errors were not thrown on http status 5xx.
- Search grouping of multiple fields with different data type causes Swift decode error.
- The search
_prefix
param is malformed. #34
Security:
- URL encode user-supplied string to prevent injection. #37
Deprecation
- Deprecate the
delete
andimportBatch
functions ofclient.collection(name: "").documents()
.
// `/documents` endpoint
// deprecated
func delete(filter: String, batchSize: Int? = nil) async throws -> (Data?, URLResponse?)
func importBatch(_ documents: Data, action: ActionModes? = ActionModes.create) async throws -> (Data?, URLResponse?)
// in favor of
func delete(options: DeleteDocumentsParameters) async throws -> (DeleteDocumentsResponse?, URLResponse?)
func importBatch(_ documents: Data, options: ImportDocumentsParameters) async throws -> (Data?, URLResponse?)
v0.2.0
What's Changed
- Updates for Typesense v0.25.x by @willtempleton in #30
Full Changelog: v0.1.2...v0.2.0
v0.1.2
Add Provision to extract value of MatchedTokens
I honestly didn't realise this was missed earlier 😅 but it's here now. You can access the values stored in your StringQuantum
type by using:
yourStringQuantum.arrStr
to get a an array of strings type of matched tokens.yourStringQuantum.arrArrStr
to get a an array of array of strings type of matched tokens.
This will return an optional because they both (arrStr and arrArrStr) can't exist at the same time. Resolves #16
v0.1.1
MultiSearch is here to typesense-swift!!
With this release of typesense-swift, you can perform multi-search across many different collections! You can achieve this with simple steps:
//Specify individual request parameters collection-wise
let searchRequests = [
MultiSearchCollectionParameters(q: "shoe", filterBy: "price:=[50..120]", collection: "products"),
MultiSearchCollectionParameters(q: "Nike", collection: "brands"),
]
//Specify common search parameters
let commonParams = MultiSearchParameters(queryBy: "name")
//data is of type MultiSearchResult<Product>
let (data, _) = try await client.multiSearch().perform(
searchRequests: searchRequests,
commonParameters: commonParams,
for: Product.self
)
Typesense Swift Beta
typesense-swift beta is finally here 🎉
You can now plug typesense-swift right into your iOS app/package and start using it!
typesense-swift supports iOS 13.0 and above.
Features added
- Authenticating the Typesense client
- Ability to create, modify, delete and read (CRUD) collections
- CRUD for documents
- Import/Export documents in batch
- Search documents using search parameters
- CRUD for API Keys
- CRUC for collection aliases
- CRUD for search synonyms
- Control cluster operations