Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add presets and stopwords endpoints #33

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

phiHero
Copy link
Contributor

@phiHero phiHero commented Aug 7, 2024

Change Summary

Create or update a preset

let schema = PresetUpsertSchema(
    value: PresetValue.singleCollectionSearch(SearchParameters(q: "apple"))
    // or: value: PresetValue.multiSearch(MultiSearchSearchesParameter(searches: [MultiSearchCollectionParameters(q: "apple")]))
)
let (data, response) = try await client.presets().upsert(presetName: "listing_view", params: schema)

Retrieve all presets

let (data, response) = try await client.presets().retrieve()

Retrieve a preset

let (data, response) = try await client.preset("listing_view").retrieve()

switch data?.value {
    case .singleCollectionSearch(let value):
        print(value)
    case .multiSearch(let value):
        print(value)
}

Delete a preset

let (data, response) = try await client.preset("listing_view").delete()

Create or update a stopwords set

let schema = StopwordsSetUpsertSchema(
    stopwords: ["states","united"],
    locale: "en"
)
let (data, response) = try await client.stopwords().upsert(stopwordsSetId: "stopword_set1", params: schema)

Retrieve all stopwords sets

let (data, response) = try await client.stopwords().retrieve()

Retrieve a stopwords set

let (data, response) = try await client.stopword("stopword_set1").retrieve()

Delete a preset

let (data, response) = try await client.stopword("stopword_set1").delete()

PR Checklist

phiHero added 5 commits August 6, 2024 21:01
commit 01eb6e7
Author: Hayden <[email protected]>
Date:   Wed Aug 7 18:26:08 2024 +0700

    update README: add stopwords documentation

commit ba8256b
Author: Hayden <[email protected]>
Date:   Wed Aug 7 18:23:22 2024 +0700

    feat: add stopwords endpoint
@phiHero phiHero changed the title Add presets endpoints Add presets and stopwords endpoints Aug 7, 2024
@jasonbosco jasonbosco merged commit dad237f into typesense:master Aug 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants