public Object run() throws Exception { checkIndexAvailability(allrepos); loadIndexingContext(allrepos); try { Collection<ArtifactInfo> searchResult = indexer.searchFlat(ArtifactInfo.VERSION_COMPARATOR, indexer.constructQuery(ArtifactInfo.NAMES, (className))); infos.addAll(convertToNBVersionInfo(postProcessClasses(searchResult, className))); } finally { unloadIndexingContext(allrepos); } return null; } });
public Object run() throws Exception { IndexingContext indexingContext = indexer.addIndexingContext( // repoId, // context id repoId, // repository id repoDir, // repository folder new File(indexDir, repoId), // index folder null, // repositoryUrl null, // index update url NB_INDEX); if (indexingContext == null) { LOGGER.warning("Indexing context chould not be created :"+repoId);//NOI18N return null; } indexer.scan(indexingContext, new RepositoryIndexerListener(indexer, indexingContext, true), true); indexer.removeIndexingContext(indexingContext, false); return null; } });
/** * Used to close all indexing context explicitly. */ public void shutdown( boolean deleteFiles ) throws IOException { getLogger().info( "Shutting down Nexus IndexerManager" ); for ( IndexingContext ctx : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( ctx, false ); } locks.clear(); }
public Object run() throws Exception { checkIndexAvailability(allrepos); loadIndexingContext(allrepos); try { BooleanQuery bq = new BooleanQuery(); bq.add(new BooleanClause(new TermQuery(new Term(ArtifactInfo.PACKAGING, "maven-archetype")), BooleanClause.Occur.MUST)); //NOI18N Collection<ArtifactInfo> search = indexer.searchFlat(ArtifactInfo.VERSION_COMPARATOR, bq); infos.addAll(convertToNBVersionInfo(search)); } finally { unloadIndexingContext(allrepos); } return null; } });
Map<String, IndexingContext> indexingContexts = indexer.getIndexingContexts(); IndexingContext indexingContext = indexingContexts.get(repo.getId()); if (indexingContext == null) { indexer.scan(indexingContext, new RepositoryIndexerListener(indexer, indexingContext, false), true);
groupIdQ = getNexusIndexer().constructQuery( MAVEN.GROUP_ID, g, SearchType.EXACT ); artifactIdQ = getNexusIndexer().constructQuery( MAVEN.ARTIFACT_ID, a, SearchType.EXACT ); versionQ = getNexusIndexer().constructQuery( MAVEN.VERSION, v, SearchType.EXACT ); IteratorSearchResponse result = getNexusIndexer().searchIterator( searchRequest );
loadIndexingContext(repo); try { Map<String, IndexingContext> indexingContexts = indexer.getIndexingContexts(); IndexingContext indexingContext = indexingContexts.get(repo.getId()); if (indexingContext == null) { File pom = new File(pomPath); if (pom.exists()) { indexer.deleteArtifactFromIndex(contextProducer.getArtifactContext(indexingContext, pom), indexingContext);
loadIndexingContext(repo); try { Map<String, IndexingContext> indexingContexts = indexer.getIndexingContexts(); IndexingContext indexingContext = indexingContexts.get(repo.getId()); if (indexingContext == null) { File pom = new File(pomPath); if (pom.exists()) { indexer.addArtifactToIndex(contextProducer.getArtifactContext(indexingContext, pom), indexingContext);
boolean unload = true; try { IndexingContext context = indexer.getIndexingContexts().get(repo.getId()); Set<String> all = indexer.getAllGroups(context); if (all.size() > 0) { if (prefix.length() == 0) { bq.add(new BooleanClause(new PrefixQuery(new Term(ArtifactInfo.UINFO, prefix)), BooleanClause.Occur.MUST)); Map<String, ArtifactInfoGroup> searchGrouped = indexer.searchGrouped(new GGrouping(), new Comparator<String>() {
public Query constructQuery( String field, String query ) { return nexusIndexer.constructQuery( field, query ); }
protected IndexingContext getRepositoryLocalIndexContext( Repository repository ) { // get context for repository IndexingContext ctx = nexusIndexer.getIndexingContexts().get( repository.getId() + CTX_LOCAL_SUFIX ); return ctx; }
/** * @param id * Repository ID. This ID has to match the ID in the repository index, due to a design bug in Maven. * @param indexDirectory * Directory that contains exploded index zip file. * @param repository * URL of the Maven repository. Used to resolve artifacts. */ public void addRemoteRepository(String id, File indexDirectory, URL repository) throws IOException, UnsupportedExistingLuceneIndexException { indexer.addIndexingContext(id, id,null, indexDirectory,null,null, NexusIndexer.DEFAULT_INDEX); remoteRepositories.add( arf.createArtifactRepository(id, repository.toExternalForm(), new DefaultRepositoryLayout(), POLICY, POLICY)); }
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(); } }
IteratorSearchResponse result = nexusIndexer.searchIterator( req );
getNexusIndexer().addArtifactToIndex( ac, context );
getNexusIndexer().deleteArtifactFromIndex( ac, context );
public Object run() throws Exception { checkIndexAvailability(allrepos); loadIndexingContext(allrepos); try { BooleanQuery bq = new BooleanQuery(); bq.add(new BooleanClause(new TermQuery(new Term(NB_DEPENDENCY_GROUP, groupId)), BooleanClause.Occur.MUST)); bq.add(new BooleanClause(new TermQuery(new Term(NB_DEPENDENCY_ARTIFACT, artifactId)), BooleanClause.Occur.MUST)); bq.add(new BooleanClause(new TermQuery(new Term(NB_DEPENDENCY_VERSION, version)), BooleanClause.Occur.MUST)); Collection<ArtifactInfo> searchResult = indexer.searchFlat(ArtifactInfo.VERSION_COMPARATOR, bq); infos.addAll(convertToNBVersionInfo(searchResult)); } finally { unloadIndexingContext(allrepos); } return null; } });
protected Query createQuery( Field field, String term, SearchType type ) { return nexusIndexer.constructQuery( field, term, type ); }
protected IndexingContext getRepositoryRemoteIndexContext( Repository repository ) { // get context for repository IndexingContext ctx = nexusIndexer.getIndexingContexts().get( repository.getId() + CTX_REMOTE_SUFIX ); return ctx; }