[MRM-1720] hard coded limitation of 30 for pageSize in SearchResultLimits

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1415201 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-29 15:09:04 +00:00
parent 19794ac917
commit 716499b132
49 changed files with 387 additions and 9 deletions

View File

@ -49,11 +49,11 @@ public class SearchResultLimits
/**
* Set page size for maximum # of hits to return per page.
*
* @param pageSize size of page by # of hits. (maximum value is 200)
* @param pageSize size of page by # of hits.
*/
public void setPageSize( int pageSize )
{
this.pageSize = Math.min( 200, pageSize );
this.pageSize = pageSize;
}
public int getSelectedPage()

View File

@ -64,6 +64,9 @@ public abstract class AbstractNexusRepositorySearch
public static String TEST_REPO_2 = "nexus-search-test-repo-2";
public static String REPO_RELEASE = "repo-release";
NexusRepositorySearch search;
ArchivaConfiguration archivaConfig;
@ -114,13 +117,13 @@ public abstract class AbstractNexusRepositorySearch
config = new Configuration();
config.addManagedRepository( createRepositoryConfig( TEST_REPO_1 ) );
config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
config.addManagedRepository( createRepositoryConfig( REPO_RELEASE ) );
}
@After
public void tearDown()
throws Exception
{
for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( indexingContext, true );
@ -211,9 +214,6 @@ public abstract class AbstractNexusRepositorySearch
}
// force flushing
context.getIndexWriter().commit();
//context.getIndexWriter().close( true );
// wait for io flush ....
//Thread.sleep( 2000 );
context.setSearchable( true );
}

View File

@ -21,6 +21,8 @@ package org.apache.archiva.indexer.search;
import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.indexer.util.SearchUtil;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.codehaus.plexus.util.FileUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@ -29,8 +31,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
@ -852,4 +854,40 @@ public class NexusRepositorySearchTest
assertNotNull( results );
assertEquals( 0, results.getHits().size() );
}
@Test
public void nolimitedResult()
throws Exception
{
File repo = new File( "target/repo-release" );
File indexDirectory = new File( repo, ".index" );
FileUtils.copyDirectoryStructure( new File( "src/test/repo-release" ), repo );
createIndex( repo.getPath(), Collections.<File>emptyList(), false );
nexusIndexer.addIndexingContext( REPO_RELEASE, REPO_RELEASE, repo, indexDirectory,
repo.toURI().toURL().toExternalForm(),
indexDirectory.toURI().toURL().toString(), search.getAllIndexCreators() );
SearchResultLimits limits = new SearchResultLimits( 0 );
limits.setPageSize( 300 );
SearchResults searchResults = search.search( null, Arrays.asList( REPO_RELEASE ), "org.example", limits,
Collections.<String>emptyList() );
log.info( "results: {}", searchResults.getHits().size() );
assertEquals( 255, searchResults.getHits().size() );
SearchFields searchFields = new SearchFields();
searchFields.setGroupId( "org.example" );
searchFields.setRepositories( Arrays.asList( REPO_RELEASE ) );
searchResults = search.search( null, searchFields, limits );
log.info( "results: {}", searchResults.getHits().size() );
assertEquals( 255, searchResults.getHits().size() );
}
}

View File

@ -0,0 +1,5 @@
￿༚
䑅千剉偔佒ć䥄塉乆伐ŵā洐ũခ朁šā瘁ݧ牯異䥤<EFBFBD>
慲瑩晡捴䥤ć癥牳楯渁Űā㄁ţ<EFBFBD>
捬慳獮慭敳ē䉵湤汥ⵓ祭扯汩捎慭攁โ畮摬攭噥牳楯渁ๅ硰潲琭偡捫慧攁ๅ硰潲琭卥牶楣攁ୂ畮摬攭乡浥Ď䥭灯牴ⵐ慣歡来Ď剥煵楲攭䉵湤汥<EFBFBD>
牯潴䝲潵灳Ď牯潴䝲潵灳䱩獴ဉ慬汇牯異猁ൡ汬䝲潵灳䱩獴<EFBFBD>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
#Thu Nov 29 13:00:04 CET 2012
nexus.index.id=repo-release
nexus.index.chain-id=1329326578955
nexus.index.timestamp=20121129120004.673 +0000
nexus.index.incremental-19=12112
nexus.index.incremental-18=12113
nexus.index.incremental-17=12114
nexus.index.incremental-16=12115
nexus.index.incremental-15=12116
nexus.index.incremental-14=12117
nexus.index.incremental-13=12118
nexus.index.incremental-9=12122
nexus.index.incremental-12=12119
nexus.index.incremental-8=12123
nexus.index.incremental-11=12120
nexus.index.incremental-7=12124
nexus.index.incremental-10=12121
nexus.index.incremental-6=12125
nexus.index.incremental-5=12126
nexus.index.incremental-4=12127
nexus.index.incremental-3=12128
nexus.index.incremental-2=12129
nexus.index.last-incremental=12131
nexus.index.incremental-1=12130
nexus.index.incremental-0=12131
nexus.index.incremental-29=12102
nexus.index.incremental-28=12103
nexus.index.incremental-27=12104
nexus.index.incremental-26=12105
nexus.index.incremental-25=12106
nexus.index.incremental-24=12107
nexus.index.time=20121129120004.673 +0000
nexus.index.incremental-23=12108
nexus.index.incremental-22=12109
nexus.index.incremental-21=12110
nexus.index.incremental-20=12111

View File

@ -0,0 +1,36 @@
#Thu Nov 29 13:00:04 CET 2012
nexus.index.id=repo-release
nexus.index.chain-id=1329326578955
nexus.index.timestamp=20121129120004.673 +0000
nexus.index.incremental-19=12112
nexus.index.incremental-18=12113
nexus.index.incremental-17=12114
nexus.index.incremental-16=12115
nexus.index.incremental-15=12116
nexus.index.incremental-14=12117
nexus.index.incremental-13=12118
nexus.index.incremental-9=12122
nexus.index.incremental-12=12119
nexus.index.incremental-8=12123
nexus.index.incremental-11=12120
nexus.index.incremental-7=12124
nexus.index.incremental-10=12121
nexus.index.incremental-6=12125
nexus.index.incremental-5=12126
nexus.index.incremental-4=12127
nexus.index.incremental-3=12128
nexus.index.incremental-2=12129
nexus.index.last-incremental=12131
nexus.index.incremental-1=12130
nexus.index.incremental-0=12131
nexus.index.incremental-29=12102
nexus.index.incremental-28=12103
nexus.index.incremental-27=12104
nexus.index.incremental-26=12105
nexus.index.incremental-25=12106
nexus.index.incremental-24=12107
nexus.index.time=20121129120004.673 +0000
nexus.index.incremental-23=12108
nexus.index.incremental-22=12109
nexus.index.incremental-21=12110
nexus.index.incremental-20=12111