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

Update code-samples request from Feb/23 #374

Merged
merged 3 commits into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 26 additions & 106 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
# the documentation on build
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
---
filtering_guide_nested_1: |-
let searchParameters = SearchParameters(
query: "thriller",
filter: "rating.users >= 90"
)
client.index("movie_ratings").search(searchParameters) { (result: Result<Searchable<Meteorite>, Swift.Error>) in
switch result {
case .success(let searchResult):
print(searchResult)
case .failure(let error):
print(error)
}
}
sorting_guide_sort_nested_1: |-
let searchParameters = SearchParameters(
query: "science fiction",
sort: ["rating.users:asc"]
)
client.index("books").search(searchParameters) { (result: Result<Searchable<Meteorite>, Swift.Error>) in
switch result {
case .success(let searchResult):
print(searchResult)
case .failure(let error):
print(error)
}
}
getting_started_faceting: |-
client.index("movies").updateFaceting({ maxValuesPerFacet: 2 })
getting_started_pagination: |-
Expand Down Expand Up @@ -942,112 +968,6 @@ search_parameter_guide_show_matches_position_1: |-
print(error)
}
}
settings_guide_stop_words_1: |-
let settings = Setting(
stopWords: [
"the",
"a",
"an"
])
client.index("movies").updateSettings(settings) { (result: Result<Searchable<Movie>, Swift.Error>) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_ranking_rules_1: |-
let settings = Setting(
rankingRules: [
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness",
"release_date:asc",
"rank:desc"
])
client.index("movies").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_distinct_1: |-
let settings = Setting(
distinctAttribute: "product_id"
)
client.index("jackets").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_searchable_1: |-
let settings = Setting(
searchableAttributes: [
"title",
"overview",
"genres"
])
client.index("movies").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_synonyms_1: |-
let settings = Setting(
synonyms: [
"sweater": ["jumper"],
"jumper": ["sweater"]
])
client.index("tops").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_displayed_1: |-
let settings = Setting(
displayedAttributes: [
"title",
"overview",
"genres",
"release_date"
])
client.index("movies").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
settings_guide_sortable_1: |-
let settings = Setting(
sortableAttributes: [
"author",
"price"
])
client.index("books").updateSettings(settings) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
add_movies_json_1: |-
let path = Bundle.main.url(forResource: "movies", withExtension: "json")!
let documents: Data = try Data(contentsOf: path)
Expand Down
Loading