public IndexingContext getRepositoryLocalIndexContext( String repositoryId ) throws NoSuchRepositoryException { Repository repository = repositoryRegistry.getRepository( repositoryId ); return getRepositoryLocalIndexContext( repository ); }
public void removeRepositoryIndexContext( String repositoryId, boolean deleteFiles ) throws IOException, NoSuchRepositoryException { Repository repository = repositoryRegistry.getRepository( repositoryId ); Lock lock = getLock( repository ).writeLock(); lock.lock(); try { if ( !isIndexingSupported( repository ) ) { logSkippingRepositoryMessage( repository ); return; } IndexingContext localCtx = getRepositoryLocalIndexContext( repository ); IndexingContext remoteCtx = getRepositoryRemoteIndexContext( repository ); if ( localCtx != null ) { nexusIndexer.removeIndexingContext( localCtx, deleteFiles ); } if ( remoteCtx != null ) { nexusIndexer.removeIndexingContext( remoteCtx, deleteFiles ); } } finally { lock.unlock(); } }
public IndexingContext getRepositoryBestIndexContext( String repositoryId ) throws NoSuchRepositoryException { IndexingContext bestContext = getRepositoryLocalIndexContext( repositoryId ); IndexingContext remoteContext = getRepositoryRemoteIndexContext( repositoryId ); if ( remoteContext != null ) { try { // if remote is here and is downloaded, it is the best (it is always the superset of local cache) if ( bestContext.getIndexReader().numDocs() < remoteContext.getIndexReader().numDocs() ) { bestContext = remoteContext; } } catch ( IOException e ) { // silent } } return bestContext; }
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
IndexingContext ctx = getRepositoryLocalIndexContext( repository );
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
public void setRepositoryIndexContextSearchable( String repositoryId, boolean searchable ) throws IOException, NoSuchRepositoryException { Repository repository = repositoryRegistry.getRepository( repositoryId ); // cannot do "!repository.isIndexable()" since we may be called to handle that config change (using events)! // the repo might be already non-indexable, but the context would still exist! if ( !isIndexingSupported( repository ) ) { logSkippingRepositoryMessage( repository ); return; } IndexingContext ctx = getRepositoryLocalIndexContext( repository ); IndexingContext rctx = getRepositoryRemoteIndexContext( repository ); // do this only if we have contexts, otherwise be muted if ( ctx != null && rctx != null ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "Searching on repository ID='" + repositoryId + "' is set to: " + String.valueOf( searchable ) ); } ctx.setSearchable( searchable ); rctx.setSearchable( searchable ); } }
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
lock.lock(); localContext = getRepositoryLocalIndexContext( repositoryId ); remoteContext = getRepositoryRemoteIndexContext( repositoryId );
IndexingContext groupContext = getRepositoryLocalIndexContext( group ); IndexingContext localContext = getRepositoryLocalIndexContext( repository ); IndexingContext remoteContext = getRepositoryRemoteIndexContext( repository );
IndexingContext localContext = getRepositoryLocalIndexContext( groupId ); IndexingContext remoteContext = getRepositoryRemoteIndexContext( group ); purgeCurrentIndex( localContext );
IndexingContext context = getRepositoryLocalIndexContext( repository );
IndexingContext context = getRepositoryLocalIndexContext( repository ); IndexingContext remoteContext = getRepositoryRemoteIndexContext( repository ); mergedContext = mergeContexts( context, remoteContext );
IndexingContext context = getRepositoryLocalIndexContext( repository );
protected void optimizeIndex( Repository repo ) throws CorruptIndexException, IOException { if ( repo.getRepositoryKind().isFacetAvailable( GroupRepository.class ) ) { GroupRepository group = repo.adaptToFacet( GroupRepository.class ); for ( Repository member : group.getMemberRepositories() ) { optimizeIndex( member ); } } // local IndexingContext context = getRepositoryLocalIndexContext( repo ); if ( context != null ) { getLogger().debug( "Optimizing local index context for repository: " + repo.getId() ); context.optimize(); } // remote context = getRepositoryRemoteIndexContext( repo ); if ( context != null ) { getLogger().debug( "Optimizing remote index context for repository: " + repo.getId() ); context.optimize(); } } }
IndexingContext context = getRepositoryLocalIndexContext( repository );