Documentation ¶
Index ¶
Constants ¶
View Source
const ( // StreetClass is the place class of streets. StreetClass = iota // LocationClass is place class of locations. LocationClass // HouseNumberClass is the place class of house numbers / buildings. HouseNumberClass )
Variables ¶
View Source
var DefaultConfig = &Config{ MaxPrefixLength: 4, MinCompletionCount: 5, MinLev: 4, DistanceCut: 4, CacheTTL: 300 * time.Second, }
DefaultConfig is the default configuration for Places.
Functions ¶
func SanitizeString ¶ added in v1.1.0
SanitizeString to unicode letters, spaces and minus
Types ¶
type Config ¶ added in v1.0.1
type Config struct { // MaxPrefixLength is the maximum prefixes length to precompute results for. MaxPrefixLength int `json:"maxPrefixLength"` // MinCompletionCount is the number of results to return. MinCompletionCount int `json:"minCompletionCount"` // MinLev is the minimum input length before doing Levenshtein comparison. MinLev int `json:"minLev"` // DistanceCut is used in result ranking. DistanceCut is the delta in distances // to ignore in favor of relevance (unless one of the results has a distance of // 0). DistanceCut int `json:"distanceCut"` // Duration to wait before evicting cache entries (in order to consider // potentially changed relevance values). CacheTTL time.Duration `json:"cacheTTL"` }
Config is the configuration for Places.
type DistrictMap ¶ added in v1.1.0
type Metrics ¶ added in v0.2.0
type Metrics struct { StreetCount int32 `json:"streetCount"` LocationCount int32 `json:"locationCount"` HouseNumberCount int32 `json:"houseNumberCount"` PrefixCount int `json:"prefixCount"` QueryCount int64 `json:"queryCount"` AvgLookupTime time.Duration `json:"avgLookupTime"` }
Metrics is the type to sore metrics.
type Place ¶ added in v1.0.1
type Place struct { ID int64 Class Class Type string Name string Street *Place HouseNumber string District *District Length int Lat float64 Lon float64 Relevance uint64 SimpleName string HouseNumbers []*Place }
func (*Place) MarshalJSON ¶ added in v1.0.1
MarshalJSON marshall a place to JSON.
type Places ¶
type Places struct {
// contains filtered or unexported fields
}
Places is where all happens.
func (*Places) GetCompletions ¶ added in v0.3.0
GetCompletions returns results for the given input.
Click to show internal directories.
Click to hide internal directories.