From 61d0936fc01ea74d789b81a91449a5ac364b208d Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Mon, 2 Feb 2009 09:46:31 +0000 Subject: [PATCH] [MRM-749] o fixed pagination git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-nexus-indexer@739952 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/indexer/search/NexusRepositorySearch.java | 4 ++-- .../archiva/indexer/search/NexusRepositorySearchTest.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java index 3d054eddf..46e758d10 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java @@ -263,7 +263,7 @@ public class NexusRepositorySearch for ( int i = 0; i < fetchCount; i++ ) { // Stop fetching if we are past the total # of available hits. - if ( offset + i > results.getTotalHits() ) + if ( offset + i >= results.getHits().size() ) { break; } @@ -280,7 +280,7 @@ public class NexusRepositorySearch } } } - paginated.setTotalHits( paginated.getHitsMap().size() ); + paginated.setTotalHits( results.getTotalHits() ); return paginated; } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java index ef15bb244..9aa02e387 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java @@ -201,7 +201,8 @@ public class NexusRepositorySearchTest archivaConfigControl.verify(); assertNotNull( results ); - assertEquals( 1, results.getTotalHits() ); + assertEquals( 1, results.getHits().size() ); + assertEquals( 2, results.getTotalHits() ); archivaConfigControl.reset(); @@ -218,7 +219,8 @@ public class NexusRepositorySearchTest archivaConfigControl.verify(); assertNotNull( results ); - assertEquals( 1, results.getTotalHits() ); + assertEquals( 1, results.getHits().size() ); + assertEquals( 2, results.getTotalHits() ); } public void testArtifactFoundInMultipleRepositories() -- 2.39.5