diff --git a/src/storage/elasticsearch/common.ts b/src/storage/elasticsearch/common.ts index 8ad3c5c3..47bfcd12 100644 --- a/src/storage/elasticsearch/common.ts +++ b/src/storage/elasticsearch/common.ts @@ -509,7 +509,7 @@ export interface ESGeoDistanceSortArguments { [field: string]: { /** - * Latitute + * Latitude */ lat: number; diff --git a/src/storage/elasticsearch/query.ts b/src/storage/elasticsearch/query.ts index 44af66a1..07bffb12 100644 --- a/src/storage/elasticsearch/query.ts +++ b/src/storage/elasticsearch/query.ts @@ -24,7 +24,6 @@ import { SCSearchSort, SCSportCoursePriceGroup, SCThingsField, - SCThingType, } from '@openstapps/core'; import { ElasticsearchConfig, @@ -317,40 +316,6 @@ export function buildQuery( elasticsearchConfig: ElasticsearchConfig, ): ESFunctionScoreQuery { - // if a sort is used it, we may have to narrow down the types so the sort is executable - let typeFiltersToAppend: ESTypeFilter[] = []; - - if (typeof params.sort !== 'undefined') { - params.sort.forEach((sort) => { - // types that the sort is supported on - const types: SCThingType[] = []; - - defaultConfig.backend.sortableFields - .filter((sortableField) => { - return sortableField.fieldName === sort.arguments.field && sortableField.sortTypes.indexOf(sort.type) > -1; - }) - .forEach((sortableField) => { - if (typeof sortableField.onlyOnTypes !== 'undefined') { - sortableField.onlyOnTypes.forEach((scType) => { - if (types.indexOf(scType) === -1) { - types.push(scType); - } - }); - } - }); - - if (types.length > 0) { - typeFiltersToAppend = types.map((type) => { - return { - type: { - value: type, - }, - }; - }); - } - }); - } - // if config provides an minMatch parameter we use query_string instead of match query let query; if (typeof elasticsearchConfig.query === 'undefined') { @@ -429,9 +394,6 @@ export function buildQuery( if (typeof params.filter !== 'undefined') { mustMatch.push(buildFilter(params.filter)); } - - // add type filters for sorts - mustMatch.push.apply(mustMatch, typeFiltersToAppend); } return functionScoreQuery;