Issue 3857 elastic lucene search returns only 50 results when offset0 and count100 (#3858)
* Add logback definition to project to stop debugging all output * Fix limit definition to include _offset=0 case * Move test required resources from previous test module * Add changelog Co-authored-by: juan.marchionatto <juan.marchionatto@smilecdr.com>
This commit is contained in:
parent
d5a69d82b2
commit
5586b325ce
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 3857
|
||||||
|
title: "Previously a lucene/elastic enabled search including offset=0 and count > 50 was returning only 50 resources
|
||||||
|
this has now been fixed."
|
||||||
|
|
|
@ -405,10 +405,11 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<IBaseResource> searchForResources(String theResourceType, SearchParameterMap theParams) {
|
public List<IBaseResource> searchForResources(String theResourceType, SearchParameterMap theParams) {
|
||||||
int offset = 0; int limit = DEFAULT_MAX_PAGE_SIZE;
|
int offset = 0;
|
||||||
|
int limit = theParams.getCount() == null ? DEFAULT_MAX_PAGE_SIZE : theParams.getCount();
|
||||||
|
|
||||||
if (theParams.getOffset() != null && theParams.getOffset() != 0) {
|
if (theParams.getOffset() != null && theParams.getOffset() != 0) {
|
||||||
offset = theParams.getOffset();
|
offset = theParams.getOffset();
|
||||||
limit = theParams.getCount() == null ? DEFAULT_MAX_PAGE_SIZE : theParams.getCount();
|
|
||||||
// indicate param was already processed, otherwise queries DB to process it
|
// indicate param was already processed, otherwise queries DB to process it
|
||||||
theParams.setOffset(null);
|
theParams.setOffset(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1874,6 +1874,21 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl
|
||||||
// also validate no extra SQL queries were executed
|
// also validate no extra SQL queries were executed
|
||||||
assertEquals(0, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size(), "bundle was built with no sql");
|
assertEquals(0, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size(), "bundle was built with no sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void offsetAndCountReturnsMoreThan50() {
|
||||||
|
for (int i = 0; i < 60; i++) {
|
||||||
|
myTestDataBuilder.createObservation(asArray(myTestDataBuilder.withObservationCode("http://example.com/", "code-" + i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
myCaptureQueriesListener.clear();
|
||||||
|
List<String> resultIds = myTestDaoSearch.searchForIds("Observation?_offset=0&_count=100");
|
||||||
|
myCaptureQueriesListener.logSelectQueriesForCurrentThread();
|
||||||
|
|
||||||
|
assertEquals(60, resultIds.size());
|
||||||
|
// also validate no extra SQL queries were executed
|
||||||
|
assertEquals(0, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size(), "bundle was built with no sql");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} [%file:%line] %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!--<logger name="ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionMatchingSubscriber" additivity="false" level="trace">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>-->
|
||||||
|
|
||||||
|
<logger name="org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="ca.uhn.fhir.jpa.dao.FhirResourceDaoSubscriptionDstu2" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.eclipse.jetty.websocket" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate.event.internal.DefaultPersistEventListener" additivity="true" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="org.eclipse" additivity="false" level="error">
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="ca.uhn.fhir.rest.client" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<logger name="ca.uhn.fhir.jpa.dao" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- set to debug to enable term expansion logs -->
|
||||||
|
<logger name="ca.uhn.fhir.jpa.term" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!-- Set to 'trace' to enable SQL logging -->
|
||||||
|
<logger name="org.hibernate.SQL" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
<!-- Set to 'trace' to enable SQL Value logging -->
|
||||||
|
<logger name="org.hibernate.type" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<logger name="ca.uhn.fhir.jpa.model.search" additivity="false" level="debug"/>
|
||||||
|
<logger name="org.elasticsearch.client" additivity="true" level="trace"/>
|
||||||
|
<logger name="org.hibernate.search.elasticsearch.request" additivity="false" level="trace"/>
|
||||||
|
<logger name="org.hibernate.search" level="TRACE"/>
|
||||||
|
<logger name="org.hibernate.search.query" level="TRACE"/>
|
||||||
|
<logger name="org.hibernate.search.elasticsearch.request" level="TRACE"/>
|
||||||
|
-->
|
||||||
|
<!-- See https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-lucene-io-writer-infostream for lucene logging
|
||||||
|
<logger name="org.hibernate.search.backend.lucene.infostream" level="TRACE"/> -->
|
||||||
|
<logger name="org.springframework.test.context.cache" additivity="false" level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue