Skip to content

NoSuchElementException when using Point in projection interface #661

@pds6196

Description

@pds6196

I’m running into an error when trying to project a Redis document that contains a Point field.

Version: 1.0.1

@Document("Flight", indexName = "FlightIdx")
data class Flight(
    @Id
    @Indexed
    var number: String,

    @Searchable
    var name: String,

    var departure: Int,
    var arrival: Int,

    @Indexed
    var location: Point = Point(0.0, 0.0),
)
interface Numbers {
    fun getNumber(): String
    fun getName(): String
    fun getLocation(): Point
}

interface FlightRepo : RedisDocumentRepository<Flight, String> {
    fun findByNumber(number: String): Numbers?
}



Sample insert and fetch:

flightRepo.save(
    Flight(
        number = "AI101",
        name = "Air India Delhi-Mumbai",
        departure = 930,
        arrival = 1130,
        location = Point(77.1025, 28.7041)
    )
)

val flight = flightRepo.findByNumber("AI101")
println(flight?.getLocation())

Error:
When calling getLocation() on the projection, I get:

java.util.NoSuchElementException: null
	at java.base/java.util.StringTokenizer.nextToken(StringTokenizer.java:349) ~[na:na]

The error disappears if I comment out getLocation() in the projection.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions