diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index 48562f4a..866cba4c 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -75,9 +75,10 @@ update_settings_1: |- "typo", "proximity", "attribute", + "sort", "exactness", - "desc(release_date)", - "desc(rank)", + "release_date:desc", + "rank:desc", }, DistinctAttribute: &distinctAttribute, SearchableAttributes: []string{ @@ -130,9 +131,10 @@ update_ranking_rules_1: |- "typo", "proximity", "attribute", + "sort", "exactness", - "asc(release_date)", - "desc(rank)", + "release_date:asc", + "rank:desc", } client.Index("movies").UpdateRankingRules(&rankingRules) reset_ranking_rules_1: |- @@ -176,6 +178,16 @@ update_displayed_attributes_1: |- client.Index("movies").UpdateDisplayedAttributes(&displayedAttributes) reset_displayed_attributes_1: |- client.Index("movies").ResetDisplayedAttributes() +sortable_attributes_get_1: |- + client.Index("books").GetSortableAttributes() +sortable_attributes_update_1: |- + sortableAttributes := []string{ + "price", + "author", + } + client.Index("books").UpdateSortableAttributes(&sortableAttributes) +sortable_attributes_reset_1: |- + client.Index("books").ResetSortableAttributes() get_index_stats_1: |- client.Index("movies").GetStats() get_indexes_stats_1: |- @@ -267,9 +279,10 @@ settings_guide_ranking_rules_1: |- "typo", "proximity", "attribute", + "sort", "exactness", - "asc(release_date)", - "desc(rank)", + "release_date:asc", + "rank:desc", } client.Index("movies").UpdateRankingRules(&rankingRules) settings_guide_distinct_1: |- @@ -408,3 +421,37 @@ get_dump_status_1: |- resp, err := client.GetDumpStatus("dump-uid") phrase_search_1: |- resp, err := client.Index("movies").Search("\"african american\" horror", &meilisearch.SearchRequest{}) +sorting_guide_update_sortable_attributes_1: |- + sortableAttributes := []string{ + "author", + "price", + } + client.Index("books").UpdateSortableAttributes(&sortableAttributes) +sorting_guide_update_ranking_rules_1: |- + rankingRules := []string{ + "words", + "sort", + "typo", + "proximity", + "attribute", + "exactness", + } + client.Index("books").UpdateRankingRules(&rankingRules) +sorting_guide_sort_parameter_1: |- + resp, err := client.Index("books").Search("science fiction", &meilisearch.SearchRequest{ + Sort: []string{ + "price:asc", + }, + }) +sorting_guide_sort_parameter_2: |- + resp, err := client.Index("books").Search("butler", &meilisearch.SearchRequest{ + Sort: []string{ + "author:desc", + }, + }) +search_parameter_guide_sort_1: |- + resp, err := client.Index("books").Search("science fiction", &meilisearch.SearchRequest{ + Sort: []string{ + "price:asc", + }, + })