spring-projects / spring-projects/spring-data-mongodb

querydsl near / geo path filters not picked up for GeoJsonPoint objects [DATAMONGO-2104]

Open
#2,972 2 comments 0 reactions 1 assignee View on GitHub

@christophstrobl is already working on this.

Since Dec 30, 2020.

in: core type: bug
Dominant language
Java
Stars
1.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Jesse Kuhnert opened DATAMONGO-2104 and commented

The apt-maven-plugin / MongoAnnotationProcessor querydsl generation combination for spring mongo does not appear to be picking up and adding near / distance calculation support to querydsl based queries. We have a Location object nested within our Store document that looks like:

public class Location {

    @TextIndexed
    private String containedInPlace;

    private String country;

    @GeoSpatialIndexed(name = "location.geo", type = GeoSpatialIndexType.GEO_2D)
    private double[] geo;

    @GeoSpatialIndexed(name = "location.geoPoint", type = GeoSpatialIndexType.GEO_2DSPHERE)
    private GeoJsonPoint geoPoint;

After we've run the maven plugin :

<plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>apt-maven-plugin</artifactId>
        <version>1.1.3</version>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <outputDirectory>target/generated-sources/java</outputDirectory>
              <processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>
              <logOnlyOnError>true</logOnlyOnError>
            </configuration>
          </execution>
        </executions>
      </plugin>

. the generated QStore.store.location.geoPoint (or the legacy double[] array coordinate) do not have any geo near methods attached as querydsl supposedly supports. The GeoJsonPoint filter generated is a SimplePath class. I've tried this using the latest querydsl dependencies for 4.2.1 release and it still doesn't pick up and recognize that I have a geo data type.

Is this an issue with the maven plugin or with the annotation processor?


Affects: 2.0.10 (Kay SR10)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.