@Test public void testNoIndexFound() throws Exception { List<String> selectedRepos = new ArrayList<>(); selectedRepos.add( TEST_REPO_1 ); SearchResults results = search.search( "user", selectedRepos, "org.apache.archiva", null, null ); assertNotNull( results ); assertEquals( 0, results.getTotalHits() ); archivaConfigControl.verify(); }
@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 );  }