Commit c72fb9e6 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

search limit was hardcoded to 10

parent 44867ebf
Pipeline #46855 passed with stage
in 16 minutes and 33 seconds
......@@ -10,6 +10,7 @@ minerva (16.0.0~beta.2) stable; urgency=medium
* Bug fix: removing background did not remove images from server (#1526)
* Bug fix: two genomic data overlay with two different reference genomes
caused issue (#1546)
* Bug fix: search results were limited to 10 elements
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 3 Sep 2021 11:00:00 +0200
......
......@@ -150,7 +150,7 @@ public class SearchService implements ISearchService {
elementFilter.put(ElementProperty.CLASS, type);
reactionFilter.put(ReactionProperty.CLASS, type);
result.addAll(elementDao.getByFilter(PageRequest.of(0, 10), elementFilter).getContent());
result.addAll(elementDao.getByFilter(pageable, elementFilter).getContent());
for (Reaction reaction : reactionDao.getByFilter(pageable, reactionFilter)) {
......
package lcsb.mapviewer.web;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.patch;
import static org.springframework.restdocs.payload.PayloadDocumentation.*;
import static org.springframework.restdocs.request.RequestDocumentation.*;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.List;
......@@ -15,7 +23,9 @@ import java.util.function.Supplier;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
......@@ -515,6 +525,20 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
.andExpect(status().is2xxSuccessful());
}
@Test
public void testSearchWithCount() throws Exception {
RequestBuilder request = get(
"/projects/{projectId}/models/{mapId}/bioEntities:search?query=p&count=1", TEST_PROJECT, "*");
String response = mockMvc.perform(request)
.andExpect(status().is2xxSuccessful())
.andReturn().getResponse().getContentAsString();
List<?> result = objectMapper.readValue(response, new TypeReference<List<?>>() {
});
assertEquals(1, result.size());
}
@Test
public void testSuggestedQueryListWithUndefinedProject() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment