fix geopoint fields to be able to be stored and retrieved
This commit is contained in:
parent
647693f1b1
commit
3ad13236ec
@ -604,6 +604,8 @@ func encodeFieldType(f document.Field) byte {
|
||||
fieldType = 'd'
|
||||
case *document.BooleanField:
|
||||
fieldType = 'b'
|
||||
case *document.GeoPointField:
|
||||
fieldType = 'g'
|
||||
case *document.CompositeField:
|
||||
fieldType = 'c'
|
||||
}
|
||||
@ -735,6 +737,8 @@ func decodeFieldType(typ byte, name string, pos []uint64, value []byte) document
|
||||
return document.NewDateTimeFieldFromBytes(name, pos, value)
|
||||
case 'b':
|
||||
return document.NewBooleanFieldFromBytes(name, pos, value)
|
||||
case 'g':
|
||||
return document.NewGeoPointFieldFromBytes(name, pos, value)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -464,6 +464,14 @@ func (i *indexImpl) SearchInContext(ctx context.Context, req *SearchRequest) (sr
|
||||
if err == nil {
|
||||
value = boolean
|
||||
}
|
||||
case *document.GeoPointField:
|
||||
lon, err := docF.Lon()
|
||||
if err == nil {
|
||||
lat, err := docF.Lat()
|
||||
if err == nil {
|
||||
value = []float64{lon, lat}
|
||||
}
|
||||
}
|
||||
}
|
||||
if value != nil {
|
||||
hit.AddFieldValue(docF.Name(), value)
|
||||
|
Loading…
Reference in New Issue
Block a user