Indexer
instead.@Deprecated public interface NexusIndexer
The following code snippet shows how to register indexing context, which should be done once on the application startup and Nexus indexer instance should be reused after that.
NexusIndexer indexer; IndexingContext context = indexer.addIndexingContext( indexId, // index 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
scan(IndexingContext)
,
addArtifactToIndex(ArtifactContext, IndexingContext)
or
deleteArtifactFromIndex(ArtifactContext, IndexingContext)
methods.
An IndexUpdater
could be used to fetch indexes from remote repositories.
These indexers could be created using the Indexer CLI command line tool or
IndexPacker
API.
Once index is populated you can perform search queries using field names declared in the 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
constructQuery(Field, SearchExpression)
method that handles creation of the wildcard queries. Also see DefaultQueryCreator
for more details on
supported queries.IndexingContext
,
IndexUpdater
,
DefaultQueryCreator
Modifier and Type | Method and Description |
---|---|
void |
addArtifactsToIndex(Collection<ArtifactContext> acs,
IndexingContext context)
Deprecated.
|
void |
addArtifactToIndex(ArtifactContext ac,
IndexingContext context)
Deprecated.
|
void |
addIndexingContext(IndexingContext context)
Deprecated.
Adds an indexing context to Nexus indexer.
|
IndexingContext |
addIndexingContext(String id,
String repositoryId,
File repository,
org.apache.lucene.store.Directory directory,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexers)
Deprecated.
Use
Indexer instead. |
IndexingContext |
addIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectory,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexers)
Deprecated.
Use
Indexer instead. |
IndexingContext |
addIndexingContextForced(String id,
String repositoryId,
File repository,
org.apache.lucene.store.Directory directory,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexers)
Deprecated.
Use
Indexer instead. |
IndexingContext |
addIndexingContextForced(String id,
String repositoryId,
File repository,
File indexDirectory,
String repositoryUrl,
String indexUpdateUrl,
List<? extends IndexCreator> indexers)
Deprecated.
Use
Indexer instead. |
IndexingContext |
addMergedIndexingContext(String id,
String repositoryId,
File repository,
org.apache.lucene.store.Directory indexDirectory,
boolean searchable,
Collection<IndexingContext> contexts)
Deprecated.
|
IndexingContext |
addMergedIndexingContext(String id,
String repositoryId,
File repository,
org.apache.lucene.store.Directory indexDirectory,
boolean searchable,
ContextMemberProvider membersProvider)
Deprecated.
|
IndexingContext |
addMergedIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectory,
boolean searchable,
Collection<IndexingContext> contexts)
Deprecated.
|
IndexingContext |
addMergedIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectory,
boolean searchable,
ContextMemberProvider membersProvider)
Deprecated.
|
void |
artifactDiscovered(ArtifactContext ac,
IndexingContext context)
Deprecated.
|
org.apache.lucene.search.Query |
constructQuery(Field field,
SearchExpression expression)
Deprecated.
Use
Indexer instead. |
org.apache.lucene.search.Query |
constructQuery(Field field,
String query,
SearchType type)
Deprecated.
Use
Indexer instead. |
void |
deleteArtifactFromIndex(ArtifactContext ac,
IndexingContext context)
Deprecated.
|
void |
deleteArtifactsFromIndex(Collection<ArtifactContext> acs,
IndexingContext context)
Deprecated.
|
Map<String,IndexingContext> |
getIndexingContexts()
Deprecated.
Use
Indexer instead. |
Collection<ArtifactInfo> |
identify(Field field,
String query)
Deprecated.
|
Collection<ArtifactInfo> |
identify(File artifact)
Deprecated.
|
Collection<ArtifactInfo> |
identify(File artifact,
Collection<IndexingContext> contexts)
Deprecated.
|
Collection<ArtifactInfo> |
identify(org.apache.lucene.search.Query query)
Deprecated.
|
Collection<ArtifactInfo> |
identify(org.apache.lucene.search.Query query,
Collection<IndexingContext> contexts)
Deprecated.
|
void |
removeIndexingContext(IndexingContext context,
boolean deleteFiles)
Deprecated.
Use
Indexer instead. |
void |
scan(IndexingContext context)
Deprecated.
Use
Indexer instead. |
void |
scan(IndexingContext context,
ArtifactScanningListener listener)
Deprecated.
Use
Indexer instead. |
void |
scan(IndexingContext context,
ArtifactScanningListener listener,
boolean update)
Deprecated.
Use
Indexer instead. |
void |
scan(IndexingContext context,
boolean update)
Deprecated.
Use
Indexer instead. |
void |
scan(IndexingContext context,
String fromPath,
ArtifactScanningListener listener,
boolean update)
Deprecated.
Use
Indexer instead. |
FlatSearchResponse |
searchFlat(FlatSearchRequest request)
Deprecated.
Use
Indexer instead. |
GroupedSearchResponse |
searchGrouped(GroupedSearchRequest request)
Deprecated.
Use
Indexer instead. |
IteratorSearchResponse |
searchIterator(IteratorSearchRequest request)
Deprecated.
Use
Indexer instead. |
static final String ROLE
void addIndexingContext(IndexingContext context)
@Deprecated IndexingContext addIndexingContext(String id, String repositoryId, File repository, File indexDirectory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexers) throws IOException, UnsupportedExistingLuceneIndexException
Indexer
instead.id
- the ID of the context.repositoryId
- the ID of the repository that this context represents.repository
- the location of the repository.indexDirectory
- the location of the Lucene indexes.repositoryUrl
- the location of the remote repository.indexUpdateUrl
- the alternate location of the remote repository indexes (if they are not in default place).indexers
- the set of indexers to apply to this context.IOException
- in case of some serious IO problem.UnsupportedExistingLuceneIndexException
- if a Lucene index already exists where location is specified, but
it has no Nexus descriptor record or it has, but the embedded repoId differs from the repoId
specified from the supplied one.IllegalArgumentException
- in case the supplied list of IndexCreators are not satisfiable@Deprecated IndexingContext addIndexingContextForced(String id, String repositoryId, File repository, File indexDirectory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexers) throws IOException
Indexer
instead.id
- the ID of the context.repositoryId
- the ID of the repository that this context represents.repository
- the location of the repository.indexDirectory
- the location of the Lucene indexes.repositoryUrl
- the location of the remote repository.indexUpdateUrl
- the alternate location of the remote repository indexes (if they are not in default place).indexers
- the set of indexers to apply to this context.IOException
- in case of some serious IO problem.IllegalArgumentException
- in case the supplied list of IndexCreators are not satisfiable@Deprecated IndexingContext addIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory directory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexers) throws IOException, UnsupportedExistingLuceneIndexException
Indexer
instead.id
- the ID of the context.repositoryId
- the ID of the repository that this context represents.repository
- the location of the repository.directory
- the location of the Lucene indexes.repositoryUrl
- the location of the remote repository.indexUpdateUrl
- the alternate location of the remote repository indexes (if they are not in default place).indexers
- the set of indexers to apply to this context.IOException
- in case of some serious IO problem.UnsupportedExistingLuceneIndexException
- if a Lucene index already exists where location is specified, but
it has no Nexus descriptor record or it has, but the embedded repoId differs from the repoId
specified from the supplied one.IllegalArgumentException
- in case the supplied list of IndexCreators are not satisfiable@Deprecated IndexingContext addIndexingContextForced(String id, String repositoryId, File repository, org.apache.lucene.store.Directory directory, String repositoryUrl, String indexUpdateUrl, List<? extends IndexCreator> indexers) throws IOException
Indexer
instead.id
- the ID of the context.repositoryId
- the ID of the repository that this context represents.repository
- the location of the repository.directory
- the location of the Lucene indexes.repositoryUrl
- the location of the remote repository.indexUpdateUrl
- the alternate location of the remote repository indexes (if they are not in default place).indexers
- the set of indexers to apply to this context.IOException
- in case of some serious IO problem.IllegalArgumentException
- in case the supplied list of IndexCreators are not satisfiable@Deprecated IndexingContext addMergedIndexingContext(String id, String repositoryId, File repository, File indexDirectory, boolean searchable, Collection<IndexingContext> contexts) throws IOException
IOException
@Deprecated IndexingContext addMergedIndexingContext(String id, String repositoryId, File repository, File indexDirectory, boolean searchable, ContextMemberProvider membersProvider) throws IOException
IOException
@Deprecated IndexingContext addMergedIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory indexDirectory, boolean searchable, Collection<IndexingContext> contexts) throws IOException
IOException
@Deprecated IndexingContext addMergedIndexingContext(String id, String repositoryId, File repository, org.apache.lucene.store.Directory indexDirectory, boolean searchable, ContextMemberProvider membersProvider) throws IOException
IOException
@Deprecated void removeIndexingContext(IndexingContext context, boolean deleteFiles) throws IOException
Indexer
instead.context
- deleteFiles
- IOException
@Deprecated Map<String,IndexingContext> getIndexingContexts()
Indexer
instead.@Deprecated void scan(IndexingContext context) throws IOException
Indexer
instead.context
- IOException
@Deprecated void scan(IndexingContext context, ArtifactScanningListener listener) throws IOException
Indexer
instead.context
- listener
- IOException
@Deprecated void scan(IndexingContext context, boolean update) throws IOException
Indexer
instead.context
- update
- if incremental reindex wanted, set true, otherwise false and full reindex will happenIOException
@Deprecated void scan(IndexingContext context, ArtifactScanningListener listener, boolean update) throws IOException
Indexer
instead.context
- listener
- update
- if incremental reindex wanted, set true, otherwise false and full reindex will happenIOException
@Deprecated void scan(IndexingContext context, String fromPath, ArtifactScanningListener listener, boolean update) throws IOException
Indexer
instead.context
- fromPath
- a path segment if you want "sub-path" reindexing (ie. reindex just a given subfolder of a
repository, ot whole repository from root.listener
- update
- if incremental reindex wanted, set true, otherwise false and full reindex will happenIOException
@Deprecated void artifactDiscovered(ArtifactContext ac, IndexingContext context) throws IOException
IOException
@Deprecated void addArtifactToIndex(ArtifactContext ac, IndexingContext context) throws IOException
IOException
@Deprecated void addArtifactsToIndex(Collection<ArtifactContext> acs, IndexingContext context) throws IOException
IOException
@Deprecated void deleteArtifactFromIndex(ArtifactContext ac, IndexingContext context) throws IOException
IOException
@Deprecated void deleteArtifactsFromIndex(Collection<ArtifactContext> acs, IndexingContext context) throws IOException
IOException
@Deprecated FlatSearchResponse searchFlat(FlatSearchRequest request) throws IOException
Indexer
instead.request
- IOException
@Deprecated IteratorSearchResponse searchIterator(IteratorSearchRequest request) throws IOException
Indexer
instead.request
- IOException
@Deprecated GroupedSearchResponse searchGrouped(GroupedSearchRequest request) throws IOException
Indexer
instead.request
- IOException
@Deprecated org.apache.lucene.search.Query constructQuery(Field field, String query, SearchType type) throws IllegalArgumentException
Indexer
instead.field
- query
- type
- IllegalArgumentException
@Deprecated org.apache.lucene.search.Query constructQuery(Field field, SearchExpression expression) throws IllegalArgumentException
Indexer
instead.field
- expression
- IllegalArgumentException
@Deprecated Collection<ArtifactInfo> identify(Field field, String query) throws IllegalArgumentException, IOException
IllegalArgumentException
IOException
@Deprecated Collection<ArtifactInfo> identify(File artifact) throws IOException
IOException
@Deprecated Collection<ArtifactInfo> identify(File artifact, Collection<IndexingContext> contexts) throws IOException
IOException
@Deprecated Collection<ArtifactInfo> identify(org.apache.lucene.search.Query query) throws IOException
IOException
@Deprecated Collection<ArtifactInfo> identify(org.apache.lucene.search.Query query, Collection<IndexingContext> contexts) throws IOException
IOException
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.