forked from shadowspore/t38c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.go
34 lines (28 loc) · 1.3 KB
/
search.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package t38c
// Search struct
type Search struct {
client tile38Client
}
// Within searches a collection for objects that are fully contained inside of a specified bounding area.
func (search *Search) Within(key string) InwAreaSelector {
return newInwAreaSelector(search.client, "WITHIN", key)
}
// Intersects searches a collection for objects that intersect a specified bounding area.
func (search *Search) Intersects(key string) InwAreaSelector {
return newInwAreaSelector(search.client, "INTERSECTS", key)
}
// Nearby command searches a collection for objects that are close to a specified point.
// The KNN algorithm is used instead of the standard overlap+Haversine algorithm,
// sorting the results in order of ascending distance from that point, i.e., nearest first.
func (search *Search) Nearby(key string, lat, lon, meters float64) InwQueryBuilder {
area := newCmd("POINT", floatString(lat), floatString(lon), floatString(meters))
return newInwQueryBuilder(search.client, "NEARBY", key, area)
}
// Search iterates though a key’s string values.
func (search *Search) Search(key string) SearchQueryBuilder {
return newSearchQueryBuilder(search.client, key)
}
// Scan incrementally iterates though a key.
func (search *Search) Scan(key string) ScanQueryBuilder {
return newScanQueryBuilder(search.client, key)
}