@Test public void testAdvancedSearchSearchFieldsAreNull() throws Exception { List<String> selectedRepos = new ArrayList<>(); selectedRepos.add( TEST_REPO_1 ); SearchFields searchFields = new SearchFields(); searchFields.setRepositories( selectedRepos ); try { search.search( "user", searchFields, null ); archivaConfigControl.verify(); fail( "A RepositorySearchExcecption should have been thrown." ); } catch ( RepositorySearchException e ) { assertEquals( "No search fields set.", e.getMessage() ); } }
@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 );  }