Skip to content

Commit 5d2c975

Browse files
committed
Add code samples for geo search
1 parent 6d516dd commit 5d2c975

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.code-samples.meilisearch.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,3 +633,31 @@ search_parameter_guide_sort_1: |-
633633
.execute()
634634
.await
635635
.unwrap();
636+
geosearch_guide_filter_settings_1: |-
637+
let progress: Progress = restaurants.set_filterable_attributes(&["_geo"]).await.unwrap();
638+
geosearch_guide_filter_usage_1: |-
639+
let results: SearchResults<Movie> = restaurants.search()
640+
.with_filter("_geoRadius(45.4628328, 9.1076931, 2000)")
641+
.execute()
642+
.await
643+
.unwrap();
644+
geosearch_guide_filter_usage_2: |-
645+
let results: SearchResults<Movie> = restaurants.search()
646+
.with_filter("_geoRadius(45.4628328, 9.1076931, 2000) AND type = pizza")
647+
.execute()
648+
.await
649+
.unwrap();
650+
geosearch_guide_sort_settings_1: |-
651+
let progress: Progress = restaurants.set_sortable_attributes(&["_geo"]).await.unwrap();
652+
geosearch_guide_sort_usage_1: |-
653+
let results: SearchResults<Restaurants> = restaurants.search()
654+
.with_sort(&["_geoPoint(48.8583701,2.2922926):asc"])
655+
.execute()
656+
.await
657+
.unwrap();
658+
geosearch_guide_sort_usage_2: |-
659+
let results: SearchResults<Restaurants> = restaurants.search()
660+
.with_sort(&["_geoPoint(48.8583701,2.2922926):asc", "rating:desc"])
661+
.execute()
662+
.await
663+
.unwrap();

0 commit comments

Comments
 (0)