hi I want used Redis as a GeoDatabase and this is my code in spring boot:
`@RedisHash(value = "DeviceData"/*,timeToLive=60l*/)
@Builder
@Data
@AllArgsConstructor
public class DeviceDataOnline extends BaseEntity<Long> {
@Id
private Long id;
@Builder.Default
private DeviceHostType hostType=DeviceHostType.VEHICLE;
@GeoIndexed
Point location;
private double alt;
private double speed;
@Min(0)
@Max(360)
private double direction;
private Boolean validity;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm", iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime packetDate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm", iso = DateTimeFormat.ISO.DATE_TIME)
private LocalDateTime recieveDate;
private byte[] sensorData;
private byte[] eventData;
private Short numberOfsats;
private Short dop;
private double milage;
public DeviceDataOnline()
{
this.hostType=DeviceHostType.VEHICLE;
}
}`
and this my Geoperations config:
` @Bean
GeoOperations<String, DeviceDataOnline> geoOperations(RedisConnectionFactory connectionFactory)
{
RedisTemplate<String,DeviceDataOnline> redisTemplate=new RedisTemplate<>();
redisTemplate.setKeySerializer(new StringRedisSerializer());
//redisTemplate.setValueSerializer(new StringRedisSerializer());
redisTemplate.setEnableDefaultSerializer(false);
redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<>(DeviceDataOnline.class));
redisTemplate.setConnectionFactory(connectionFactory);
redisTemplate.afterPropertiesSet();
GeoOperations<String,DeviceDataOnline> geoOpt=redisTemplate.opsForGeo();
return geoOpt;
}`
when i call this methode :
@
`Override
public Flux<DeviceDataDto> getAllLiveMovableInBox(BoxDto box) {
double height=box.getTopRight().getX()-box.getBottomLeft().getX();
double width=box.getTopRight().getY()-box.getBottomLeft().getY();
GeoReference.GeoCoordinateReference refrenc=new GeoReference.GeoCoordinateReference(box.getBottomLeft().getX(),box.getBottomLeft().getX());
GeoResults<GeoLocation<DeviceDataOnline>> results=
geoOperations.search(key,refrenc,new BoundingBox(height,width,Metrics.KILOMETERS));
return Flux.fromIterable(results.getContent().stream().map(t>t.getContent().getName()).map(onlineMapper::toDto).collect(Collectors.toList()));
}`
i get this error : WRONGTYPE Operation against a key holding the wrong kind of value
i expect geoOperations.search method return a GeoResult which contain stream of DeviceDataOnline