Skip to content

Commit

Permalink
INFRA-8308 Fixes IHTSDO#367 return concept ids as strings when return…
Browse files Browse the repository at this point in the history
…IdOnly param used.
  • Loading branch information
Darryn McGaw authored and njmarques committed Jun 16, 2023
1 parent 7c769ff commit e077cc2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 7.7.0 Release

### Breaking
- General
- When using `returnIdOnly` parameter; the ids returned now use 'string' rather than 'number' JSON data type, to avoid rounding. Fixes #367.

## 7.6.0 Release (Jan 2022)
Minor release with bug fixes and improvements.

Expand All @@ -28,7 +34,6 @@ Minor release with bug fixes and improvements.
- Authoring
- MAINT-1842 Fix false warnings when using semantic tag pattern.


## 7.5.4 Release (Dec 2021)
Maintenance release with new features in FHIR and many improvements and fixes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.snomed.snowstorm.core.pojo.BranchTimepoint;
import org.snomed.snowstorm.core.pojo.LanguageDialect;
import org.snomed.snowstorm.core.util.PageHelper;
import org.snomed.snowstorm.core.util.SearchAfterPage;
import org.snomed.snowstorm.core.util.SearchAfterPageImpl;
import org.snomed.snowstorm.core.util.TimerUtil;
import org.snomed.snowstorm.ecl.validation.ECLValidator;
import org.snomed.snowstorm.rest.converter.SearchAfterHelper;
Expand All @@ -46,6 +48,7 @@

import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;

import static io.kaicode.elasticvc.api.ComponentService.LARGE_PAGE;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
Expand Down Expand Up @@ -181,7 +184,10 @@ public ItemsPage<?> findConcepts(
pageRequest = getPageRequestWithSort(offset, limit, searchAfter, Sort.sort(QueryConcept.class).by(QueryConcept::getConceptIdL).descending());
}
if (returnIdOnly) {
return new ItemsPage<>(queryService.searchForIds(queryBuilder, branch, pageRequest));
SearchAfterPage<Long> longsPage = queryService.searchForIds(queryBuilder, branch, pageRequest);
SearchAfterPageImpl<String> stringPage = new SearchAfterPageImpl<>(longsPage.stream().map(Object::toString).collect(Collectors.toList()),
longsPage.getPageable(), longsPage.getTotalElements(), longsPage.getSearchAfter());
return new ItemsPage<>(stringPage);
} else {
return new ItemsPage<>(queryService.search(queryBuilder, branch, pageRequest));
}
Expand Down

0 comments on commit e077cc2

Please sign in to comment.