]> source.dussan.org Git - archiva.git/commitdiff
[MRM-749]
authorMaria Odea B. Ching <oching@apache.org>
Mon, 2 Feb 2009 09:46:31 +0000 (09:46 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Mon, 2 Feb 2009 09:46:31 +0000 (09:46 +0000)
o fixed pagination

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-nexus-indexer@739952 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java

index 3d054eddff69764a32ecf04bdef2a98cf8044164..46e758d105b314e5c70899ad2b566f73d3f17aea 100644 (file)
@@ -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;
     }
index ef15bb2441a1c8df89e973f5f854d0ecfe913b93..9aa02e3876375697209a83b76f8c86ab21d16c6b 100644 (file)
@@ -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()