[MRM-861]

-fix search results hits count


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675469 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2008-07-10 07:47:38 +00:00
parent 2b2e21c613
commit 59313f36c3
4 changed files with 14 additions and 7 deletions

View File

@ -64,7 +64,7 @@ public class FileContentRecord
public String getPrimaryKey()
{
return filename;
return repositoryId + ":" + filename;
}
public int hashCode()

View File

@ -199,7 +199,7 @@ public class DefaultCrossRepositorySearch
if ( offset < hitCount )
{
// only process if the offset is within the hit count.
for ( int i = 0; i <= fetchCount; i++ )
for ( int i = 0; i < fetchCount; i++ )
{
// Stop fetching if we are past the total # of available hits.
if ( offset + i >= hitCount )

View File

@ -34,8 +34,11 @@ import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
import org.apache.maven.archiva.indexer.search.CrossRepositorySearch;
import org.apache.maven.archiva.indexer.search.SearchResultLimits;
import org.apache.maven.archiva.indexer.search.SearchResults;
import org.apache.maven.archiva.security.*;
import org.apache.maven.archiva.security.AccessDeniedException;
import org.apache.maven.archiva.security.ArchivaSecurityException;
import org.apache.maven.archiva.security.ArchivaXworkUser;
import org.apache.maven.archiva.security.PrincipalNotFoundException;
import org.apache.maven.archiva.security.UserRepositories;
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
/**
@ -110,6 +113,10 @@ public class SearchAction
totalPages = results.getTotalHits() / limits.getPageSize();
if( (results.getTotalHits() % limits.getPageSize()) != 0 )
{
totalPages = totalPages + 1;
}
// TODO: filter / combine the artifacts by version? (is that even possible with non-artifact hits?)
/* I don't think that we should, as I expect us to utilize the 'score' system in lucene in

View File

@ -49,8 +49,8 @@
<%-- search was made from the indices --%>
<c:when test="${databaseResults == null}">
<c:set var="hitsNum">${fn:length(results.hits) + (currentPage * 31)}</c:set>
<p>Hits: ${hitsNum - 30} to ${hitsNum} of ${results.totalHits}</p>
<c:set var="hitsNum">${fn:length(results.hits) + (currentPage * results.limits.pageSize)}</c:set>
<p>Hits: ${(hitsNum - results.limits.pageSize) + 1} to ${hitsNum} of ${results.totalHits}</p>
<c:choose>
<c:when test="${empty results.hits}">