refactor: use geo for sort after backend change

Closes #210
This commit is contained in:
Jovan Krunić
2022-05-18 09:41:18 +02:00
parent b7ae2cf019
commit 9efc41a8f8
5 changed files with 201 additions and 81 deletions

View File

@@ -312,7 +312,7 @@ const sampleIndexResponse: SCIndexResponse = {
sortTypes: ['ducet'],
},
{
fieldName: 'geo.point.coordinates',
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
@@ -321,7 +321,7 @@ const sampleIndexResponse: SCIndexResponse = {
sortTypes: ['distance'],
},
{
fieldName: 'geo.point.coordinates',
fieldName: 'geo',
onlyOnTypes: [
SCThingType.Building,
SCThingType.PointOfInterest,
@@ -330,7 +330,7 @@ const sampleIndexResponse: SCIndexResponse = {
sortTypes: ['distance'],
},
{
fieldName: 'inPlace.geo.point.coordinates',
fieldName: 'inPlace.geo',
onlyOnTypes: [
SCThingType.DateSeries,
SCThingType.Dish,

View File

@@ -28,22 +28,6 @@ export class FoodDataListComponent extends SearchPageComponent {
initialize() {
this.showDefaultData = true;
if (this.positionService.position) {
this.sortQuery = [
{
type: 'distance',
order: 'asc',
arguments: {
field: 'geo.point.coordinates',
position: [
this.positionService.position.longitude,
this.positionService.position.latitude,
],
},
},
];
}
this.sortQuery = [
{
arguments: {field: 'name'},
@@ -88,5 +72,21 @@ export class FoodDataListComponent extends SearchPageComponent {
},
type: 'boolean',
};
if (this.positionService.position) {
this.sortQuery = [
{
type: 'distance',
order: 'asc',
arguments: {
field: 'geo',
position: [
this.positionService.position.longitude,
this.positionService.position.latitude,
],
},
},
];
}
}
}

View File

@@ -134,7 +134,6 @@ export class MapProvider {
/**
* Provide places (buildings and canteens) const result = await this.dataProvider.search(query);
*
* @param contextFilter Additional contextual filter (e.g. from the context menu)
* @param queryText Query (text) of the search query
@@ -223,7 +222,7 @@ export class MapProvider {
type: 'distance',
order: 'asc',
arguments: {
field: 'geo.point.coordinates',
field: 'geo',
position: [
this.positionService.position.longitude,
this.positionService.position.latitude,