@Test public void nolimitedResult() throws Exception { Path repo = Paths.get("target/repo-release"); try { Path indexDirectory = repo.resolve(".indexer"); Path zipFile = Paths.get(Thread.currentThread().getContextClassLoader().getResource("repo-release.zip").toURI()); FileUtils.unzip(zipFile, repo.getParent()); IndexUpgrader.main(new String[]{indexDirectory.toAbsolutePath().toString()}); createIndex(REPO_RELEASE, Collections.emptyList(), false, indexDirectory, false); SearchResultLimits limits = new SearchResultLimits(SearchResultLimits.ALL_PAGES); limits.setPageSize(300); EasyMock.expect(archivaConfig.getConfiguration()).andReturn(config).anyTimes(); archivaConfigControl.replay(); SearchResults searchResults = search.search(null, Arrays.asList(REPO_RELEASE), "org.example", limits, Collections.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()); archivaConfigControl.verify(); } finally { FileUtils.deleteQuietly(repo); } }
@Override public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE ); BooleanQuery.Builder qb = new BooleanQuery.Builder(); if ( previousSearchTerms == null || previousSearchTerms.isEmpty() ) { constructQuery( term, qb ); } else { for ( String previousTerm : previousSearchTerms ) { BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( previousTerm, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( term, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true ); }
MavenRepositorySearch implements RepositorySearch { @Override public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE ); BooleanQuery.Builder qb = new BooleanQuery.Builder(); if ( previousSearchTerms == null || previousSearchTerms.isEmpty() ) { constructQuery( term, qb ); } else { for ( String previousTerm : previousSearchTerms ) { BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( previousTerm, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( term, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true ); } }
MavenRepositorySearch implements RepositorySearch { @Override public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE ); BooleanQuery.Builder qb = new BooleanQuery.Builder(); if ( previousSearchTerms == null || previousSearchTerms.isEmpty() ) { constructQuery( term, qb ); } else { for ( String previousTerm : previousSearchTerms ) { BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( previousTerm, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( term, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true ); } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); }
MavenRepositorySearch implements RepositorySearch { @Override public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE ); BooleanQuery.Builder qb = new BooleanQuery.Builder(); if ( previousSearchTerms == null || previousSearchTerms.isEmpty() ) { constructQuery( term, qb ); } else { for ( String previousTerm : previousSearchTerms ) { BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( previousTerm, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( term, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true ); } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); @Override SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
                                List<String> previousSearchTerms ); @SuppressWarnings( "deprecation" ) @Override SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ); @Override Set<String> getRemoteIndexingContextIds( String managedRepoId ); @Override Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ); }
MavenRepositorySearch implements RepositorySearch { @Override public SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException { List<String> indexingContextIds = addIndexingContexts( selectedRepos ); BooleanQuery.setMaxClauseCount( Integer.MAX_VALUE ); BooleanQuery.Builder qb = new BooleanQuery.Builder(); if ( previousSearchTerms == null || previousSearchTerms.isEmpty() ) { constructQuery( term, qb ); } else { for ( String previousTerm : previousSearchTerms ) { BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( previousTerm, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } BooleanQuery.Builder iQuery = new BooleanQuery.Builder(); constructQuery( term, iQuery ); qb.add( iQuery.build(), BooleanClause.Occur.MUST ); } return search( limits, qb.build(), indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true ); } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); @Override SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
                                List<String> previousSearchTerms ); @SuppressWarnings( "deprecation" ) @Override SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ); @Override Set<String> getRemoteIndexingContextIds( String managedRepoId ); @Override Collection<String> getAllGroupIds( String principal, List<String> selectedRepos );  }