if( response == null || response.getTotalHits() == 0 )
{
- return new SearchResults();
+ SearchResults results = new SearchResults();
+ results.setLimits( limits );
+ return results;
}
return convertToSearchResults( response, limits );
}
results.setTotalHits( results.getHitsMap().size() );
+ results.setLimits( limits );
if( limits == null || limits.getSelectedPage() == SearchResultLimits.ALL_PAGES )
{
}
else
{
- return paginate( limits, results );
+ return paginate( results );
}
}
- private SearchResults paginate( SearchResultLimits limits, SearchResults results )
+ private SearchResults paginate( SearchResults results )
{
- SearchResults paginated = new SearchResults();
+ SearchResultLimits limits = results.getLimits();
+ SearchResults paginated = new SearchResults();
+
int fetchCount = limits.getPageSize();
int offset = ( limits.getSelectedPage() * limits.getPageSize() );
}
}
paginated.setTotalHits( results.getTotalHits() );
+ paginated.setLimits( limits );
return paginated;
}
assertNotNull( results );
assertEquals( 1, results.getHits().size() );
assertEquals( 2, results.getTotalHits() );
+ assertEquals( limits, results.getLimits() );
archivaConfigControl.reset();
assertNotNull( results );
assertEquals( 1, results.getHits().size() );
assertEquals( 2, results.getTotalHits() );
+ assertEquals( limits, results.getLimits() );
}
public void testArtifactFoundInMultipleRepositories()
}
SearchFields searchFields = new SearchFields( groupId, artifactId, version, null, className, selectedRepos );
-
-
- // TODO: add packaging in the list of fields for advanced search (UI)
+
+ // TODO: add packaging in the list of fields for advanced search (UI)?
try
{
results = getNexusSearch().search( getPrincipal(), searchFields, limits );