Skip to content

Commit ddbcbee

Browse files
committed
search-api: Use unmapped_type = keyword rather than long
Not entierly sure why it was set to `long` previously, but since this is in the `defaultSort` function that is only used for `keywordField`'s i think its safe to change it to keyword.
1 parent ac17178 commit ddbcbee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

search-api/src/main/scala/no/ndla/searchapi/service/search/MultiDraftSearchService.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ trait MultiDraftSearchService {
217217
val pagination = getStartAtAndNumResults(settings.page, settings.pageSize).?
218218
val aggregations = buildTermsAggregation(settings.aggregatePaths, indexServices.map(_.getMapping))
219219
val index = getSearchIndexes(settings).?
220+
val sort = getSortDefinition(settings.sort, searchLanguage)
220221
val searchToExecute = search(index)
221222
.query(filteredSearch)
222223
.suggestions(suggestions(settings.query.underlying, searchLanguage, settings.fallback))
@@ -225,7 +226,7 @@ trait MultiDraftSearchService {
225226
.size(pagination.pageSize)
226227
.highlighting(highlight("*"))
227228
.aggs(aggregations)
228-
.sortBy(getSortDefinition(settings.sort, searchLanguage))
229+
.sortBy(sort)
229230

230231
// Only add scroll param if it is first page
231232
val searchWithScroll =

search-api/src/main/scala/no/ndla/searchapi/service/search/SearchService.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ trait SearchService {
297297
fieldSort(s"$withLanguage.$sortLanguage.raw")
298298
.sortOrder(order)
299299
.missing("_last")
300-
.unmappedType("long")
300+
.unmappedType("keyword")
301301
}
302302
}
303303

0 commit comments

Comments
 (0)