0
0

Merge pull request #474 from steveyen/simplify-AddLocation

simplify TermLocationMap.AddLocation()
This commit is contained in:
Marty Schoch 2016-10-12 14:20:50 +02:00 committed by GitHub
commit d026a44230

View File

@ -47,15 +47,7 @@ type Locations []*Location
type TermLocationMap map[string]Locations
func (t TermLocationMap) AddLocation(term string, location *Location) {
existingLocations, exists := t[term]
if exists {
existingLocations = append(existingLocations, location)
t[term] = existingLocations
} else {
locations := make(Locations, 1)
locations[0] = location
t[term] = locations
}
t[term] = append(t[term], location)
}
type FieldTermLocationMap map[string]TermLocationMap