Revision 36d4abe5
Added by Andreas Müller about 2 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/search/LuceneSearch.java | ||
---|---|---|
235 | 235 |
logger.info("final query: " + fullQuery.toString()); |
236 | 236 |
|
237 | 237 |
int offset = pageNumber * pageSize; |
238 |
int limit = (pageNumber + 1) * pageSize - 1 ;
|
|
238 |
int limit = (pageNumber + 1) * pageSize; |
|
239 | 239 |
logger.debug("start: " + offset + "; limit:" + limit); |
240 | 240 |
|
241 | 241 |
// sorting |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/TaxonServiceSearchTest.java | ||
---|---|---|
884 | 884 |
pager = taxonService.findTaxaAndNamesByFullText( |
885 | 885 |
taxaAndSynonyms, "Abies", classification, subtree, null, null, null, true, null, null, null, null); |
886 | 886 |
Assert.assertEquals("doTaxa & doSynonyms & unpublished", 8, pager.getCount().intValue()); |
887 |
TaxonBase<?> result3 = pager.getRecords().get(3).getEntity(); |
|
888 |
|
|
889 |
//test paging |
|
890 |
pager = taxonService.findTaxaAndNamesByFullText( |
|
891 |
taxaAndSynonyms, "Abies", classification, subtree, null, null, null, true, 2, 1, null, null); |
|
892 |
Assert.assertEquals("doTaxa & doSynonyms & unpublished & second page & page size 2", 2, pager.getRecords().size()); |
|
893 |
TaxonBase<?> result1 = pager.getRecords().get(1).getEntity(); |
|
894 |
Assert.assertEquals("Second result in second page with size=2 must be the same as 4th result in full result", result3, result1); |
|
887 | 895 |
|
888 | 896 |
EnumSet<TaxaAndNamesSearchMode> taxaOnly = EnumSet.of(TaxaAndNamesSearchMode.doTaxa, TaxaAndNamesSearchMode.includeUnpublished); |
889 | 897 |
|
Also available in: Unified diff
fix #9948 fix incorrect handling of "limit" in LuceneSearch and add paging test for lucene search