x id (usually the same as repository id) repositoryId, // repository id directory, // Lucene directory where index is stored repositoryDir, // local repository dir or null for remote repo repositoryUrl, // repository url, used by index updater indexUpdateUrl, // index update url or null if derived from repositoryUrl false, false ); An indexing context could be populated using one of {@link #scan(IndexingContext)}, {@link #addArtifactToIndex(ArtifactContext,IndexingContext)} or{@link #deleteArtifactFromIndex(ArtifactContext,IndexingContext)} methods.
An {@link IndexUpdater} could be used to fetch indexes from remote repositories. These indexers could be createdusing the {@link NexusIndexerCli} command line tool or {@link IndexPacker} API.
Once index is populated you can perform search queries using field names declared in the {@link ArtifactInfo}:
// run search query BooleanQuery q = new BooleanQuery(); q.add(indexer.constructQuery(ArtifactInfo.GROUP_ID, term), Occur.SHOULD); q.add(indexer.constructQuery(ArtifactInfo.ARTIFACT_ID, term), Occur.SHOULD); q.add(new PrefixQuery(new Term(ArtifactInfo.SHA1, term)), Occur.SHOULD); FlatSearchRequest request = new FlatSearchRequest(q); FlatSearchResponse response = indexer.searchFlat(request); ...
Query could be also constructed using a convenience {@link NexusIndexer#constructQuery(Field,SearchExpression)}method that handles creation of the wildcard queries. Also see {@link DefaultQueryCreator} for more details onsupported queries.
@see IndexingContext
@see IndexUpdater
@see DefaultQueryCreator
@author Jason van Zyl
@author Tamas Cservenak
@author Eugene Kuleshov
@deprecated Use {@link Indexer} instead.