mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2025-12-11 00:36:14 +00:00
fix: geo.point has wrong mapping
This commit is contained in:
5
.changeset/rich-rats-guess.md
Normal file
5
.changeset/rich-rats-guess.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@openstapps/backend": patch
|
||||
---
|
||||
|
||||
fix for geo.point mapping
|
||||
@@ -25,7 +25,7 @@ export function buildDistanceFilter(
|
||||
): QueryDslSpecificQueryContainer<'geo_distance'> {
|
||||
const geoObject: QueryDslGeoDistanceQuery = {
|
||||
distance: `${filter.arguments.distance}m`,
|
||||
[`${filter.arguments.field}.point.coordinates`]: {
|
||||
[`${filter.arguments.field}.point`]: {
|
||||
lat: filter.arguments.position[1],
|
||||
lon: filter.arguments.position[0],
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ export function buildDistanceSort(sort: SCDistanceSort): SortOptions {
|
||||
mode: 'avg',
|
||||
order: sort.order,
|
||||
unit: 'm',
|
||||
[`${sort.arguments.field}.point.coordinates`]: {
|
||||
[`${sort.arguments.field}.point`]: {
|
||||
lat: sort.arguments.position[1],
|
||||
lon: sort.arguments.position[0],
|
||||
},
|
||||
|
||||
@@ -466,7 +466,7 @@ describe('Query', function () {
|
||||
const expectedFilter: QueryDslSpecificQueryContainer<'geo_distance'> = {
|
||||
geo_distance: {
|
||||
'distance': '1000m',
|
||||
'geo.point.coordinates': {
|
||||
'geo.point': {
|
||||
lat: 8.123,
|
||||
lon: 50.123,
|
||||
},
|
||||
@@ -636,7 +636,7 @@ describe('Query', function () {
|
||||
'mode': 'avg',
|
||||
'order': 'desc',
|
||||
'unit': 'm',
|
||||
'geo.point.coordinates': {
|
||||
'geo.point': {
|
||||
lat: 50.123,
|
||||
lon: 8.123,
|
||||
},
|
||||
|
||||
@@ -27,15 +27,7 @@ export const premaps: Record<string, MappingProperty> = {
|
||||
type: 'geo_shape',
|
||||
},
|
||||
'Point': {
|
||||
properties: {
|
||||
type: {
|
||||
type: 'keyword',
|
||||
},
|
||||
coordinates: {
|
||||
type: 'geo_point',
|
||||
},
|
||||
},
|
||||
dynamic: 'strict',
|
||||
type: 'geo_point',
|
||||
},
|
||||
'Polygon': {
|
||||
type: 'geo_shape',
|
||||
|
||||
Reference in New Issue
Block a user