photoprism/internal/form/geo_search.go
Michael Mayer 3edf30ab3a Reduce location precision to float32
This is the practical limit of commercial data and should be more than enough for our use case while ideally providing better index performance.

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-04-26 11:41:54 +02:00

37 lines
967 B
Go

package form
import "time"
// GeoSearch represents search form fields for "/api/v1/geo".
type GeoSearch struct {
Query string `form:"q"`
Before time.Time `form:"before" time_format:"2006-01-02"`
After time.Time `form:"after" time_format:"2006-01-02"`
Favorite bool `form:"favorite"`
Lat float32 `form:"lat"`
Lng float32 `form:"lng"`
S2 string `form:"s2"`
Olc string `form:"olc"`
Dist uint `form:"dist"`
Quality int `form:"quality"`
Review bool `form:"review"`
}
// GetQuery returns the query parameter as string.
func (f *GeoSearch) GetQuery() string {
return f.Query
}
// SetQuery sets the query parameter.
func (f *GeoSearch) SetQuery(q string) {
f.Query = q
}
// ParseQueryString parses the query parameter if possible.
func (f *GeoSearch) ParseQueryString() error {
return ParseQueryString(f)
}
func NewGeoSearch(query string) GeoSearch {
return GeoSearch{Query: query}
}