/** * Used to close all indexing context explicitly. */ public void shutdown(boolean deleteFiles) throws IOException { log.info("Shutting down Nexus IndexerManager"); for (IndexingContext ctx : mavenIndexer.getIndexingContexts().values()) { mavenIndexer.removeIndexingContext(ctx, false); } synchronized (repositoryLocks) { repositoryLocks.clear(); } synchronized (reindexLocks) { reindexLocks.clear(); } }
public Query constructQuery(Field field, SearchExpression expression) throws IllegalArgumentException { return mavenIndexer.constructQuery(field, expression); }
IndexingContext context = indexer.getIndexingContexts().get( repository.getId() ); context = indexer.getIndexingContexts().get( repository.getId() ); context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, indexDirectory, repositoryDirectory.toURI().toURL().toExternalForm(),
IndexingContext context = indexer.addIndexingContext( // indexer.scan( context, listener, true ); indexer.removeIndexingContext( context, false );
@Override protected List<IndexingContext> getIndexingContexts() { return new ArrayList<IndexingContext>( nexusIndexer.getIndexingContexts().values() ); } }
mavenIndexer.removeIndexingContext(oldContext, true); mavenIndexer.addMergedIndexingContext(getContextId(repository.getId()), repository.getId(), repoRoot, indexDirectory, repository.isSearchable(), Collections.<IndexingContext>emptyList()); mavenIndexer.addIndexingContext(ctx);
final Query pq = indexer.constructQuery(MAVEN.PACKAGING, new SourcedSearchExpression("maven-archetype")); return indexer.searchIterator(sreq);
creators.addAll(container.lookupList(IndexCreator.class)); String indexurl = repositoryUrl + (!repositoryUrl.endsWith( "/") ? "/" : "") + ".index"; IndexingContext indexingContext = indexer.addIndexingContextForced( "central", // context id "central", // repository id indexer.removeIndexingContext(indexingContext, false);
private void removeRepositoryIndexingContext(final Repository repository, final boolean deleteFiles, final IndexingContext context) throws IOException { if (context != null) { log.debug("Removing indexing context for repository {} deleteFiles={}", repository.getId(), deleteFiles); mavenIndexer.removeIndexingContext(context, deleteFiles); log.debug("Removed indexing context {} for repository {}", context.getId(), repository.getId()); } else { log.debug("Could not remove <null> indexing context for repository {}", repository.getId()); } }
req.getContexts().addAll(lockedContexts.contexts.values()); IteratorSearchResponse result = mavenIndexer.searchIterator(req);
private FlatSearchResponse searchFlat(String repositoryId, FlatSearchRequest req) throws NoSuchRepositoryException { LockedIndexingContexts lockedContexts = lockSearchTargetIndexingContexts(repositoryId); if (lockedContexts == null) { return new FlatSearchResponse(req.getQuery(), 0, Collections.<ArtifactInfo>emptySet()); } try { req.getContexts().addAll(lockedContexts.contexts.values()); FlatSearchResponse result = mavenIndexer.searchFlat(req); postprocessResults(result.getResults()); return result; } catch (BooleanQuery.TooManyClauses e) { if (log.isDebugEnabled()) { log.debug("Too many clauses exception caught:", e); } // XXX: a hack, I am sending too many results by setting the totalHits value to -1! return new FlatSearchResponse(req.getQuery(), -1, new HashSet<ArtifactInfo>()); } catch (IOException e) { log.error("Got I/O exception while searching for query \"" + req.getQuery() + "\"", e); return new FlatSearchResponse(req.getQuery(), 0, new HashSet<ArtifactInfo>()); } finally { lockedContexts.lock.unlock(); } }
IndexingContext indexingContext = indexer.getIndexingContexts().get( contextKey ); if ( indexingContext != null ) return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), mavenIndexerUtils.getAllIndexCreators() );
/** * @noreference this method is meant for unit tests only */ public IndexingContext getRepositoryIndexContext(String repositoryId) { return mavenIndexer.getIndexingContexts().get(getContextId(repositoryId)); }
final Query pq = indexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( "maven-archetype" ) ); return indexer.searchIterator( sreq );
FlatSearchResponse response = indexer.searchFlat( request );
@PreDestroy public void shutdown() throws RepositoryAdminException { try { // close index on shutdown for ( ManagedRepository managedRepository : getManagedRepositories() ) { IndexingContext context = indexer.getIndexingContexts().get( managedRepository.getId() ); if ( context != null ) { indexer.removeIndexingContext( context, false ); } } } catch ( IOException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } }
indexer.addIndexingContext( tempRepoId, tempRepoId, mergedIndexDirectory, indexLocation, null, null, mavenIndexerUtils.getAllIndexCreators() ); IndexingContext idxToMerge = indexer.getIndexingContexts().get( repoId ); if ( idxToMerge != null )
private List<IndexingContext> getIndexingContexts( List<String> ids ) { List<IndexingContext> contexts = new ArrayList<>( ids.size() ); for ( String id : ids ) { IndexingContext context = indexer.getIndexingContexts().get( id ); if ( context != null ) { contexts.add( context ); } else { log.warn( "context with id {} not exists", id ); } } return contexts; }
@Deprecated public Query constructQuery(Field field, String query, SearchType type) throws IllegalArgumentException { return mavenIndexer.constructQuery(field, query, type); }
@PreDestroy private void shutdown() throws RepositoryAdminException { try { List<RemoteRepository> remoteRepositories = getRemoteRepositories(); // close index on shutdown for ( RemoteRepository remoteRepository : remoteRepositories ) { IndexingContext context = indexer.getIndexingContexts().get( remoteRepository.getId() ); if ( context != null ) { indexer.removeIndexingContext( context, false ); } } } catch ( IOException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } }