| Constructor and Description |
|---|
DefaultIndexer(SearchEngine searcher,
IndexerEngine indexerEngine,
QueryCreator queryCreator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addArtifactsToIndex(Collection<ArtifactContext> ac,
IndexingContext context)
Adds the passed in artifact contexts to passed in indexing context.
|
void |
addArtifactToIndex(ArtifactContext ac,
IndexingContext context)
Adds the passed in artifact contexts to passed in indexing context.
|
void |
closeIndexingContext(IndexingContext context,
boolean deleteFiles)
Closes the indexing context: closes it and deletes (if specified) the index files.
|
org.apache.lucene.search.Query |
constructQuery(Field field,
SearchExpression expression)
Helper method to construct Lucene query for given field without need for knowledge (on caller side) HOW is a
field indexed, and WHAT query is needed to achieve that search.
|
org.apache.lucene.search.Query |
constructQuery(Field field,
String expression,
SearchType searchType)
Helper method to construct Lucene query for given field without need for knowledge (on caller side) HOW is a
field indexed, and WHAT query is needed to achieve that search.
|
IndexingContext |
createIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectory,
String repositoryUrl,
String indexUpdateUrl,
boolean searchable,
boolean reclaim,
List<? extends IndexCreator> indexers)
Creates an indexing context.
|
IndexingContext |
createMergedIndexingContext(String id,
String repositoryId,
File repository,
File indexDirectory,
boolean searchable,
ContextMemberProvider membersProvider)
Creates a merged indexing context.
|
void |
deleteArtifactsFromIndex(Collection<ArtifactContext> ac,
IndexingContext context)
Removes the passed in artifacts contexts from passed in indexing context.
|
Collection<ArtifactInfo> |
identify(File artifact,
Collection<IndexingContext> contexts)
Performs an "identity" search.
|
Collection<ArtifactInfo> |
identify(org.apache.lucene.search.Query query,
Collection<IndexingContext> contexts)
Performs an "identity" search.
|
FlatSearchResponse |
searchFlat(FlatSearchRequest request)
Searches according the request parameters.
|
GroupedSearchResponse |
searchGrouped(GroupedSearchRequest request)
Searches according the request parameters.
|
IteratorSearchResponse |
searchIterator(IteratorSearchRequest request)
Searches according to request parameters.
|
@Inject public DefaultIndexer(SearchEngine searcher, IndexerEngine indexerEngine, QueryCreator queryCreator)
public IndexingContext createIndexingContext(String id, String repositoryId, File repository, File indexDirectory, String repositoryUrl, String indexUpdateUrl, boolean searchable, boolean reclaim, List<? extends IndexCreator> indexers) throws IOException, ExistingLuceneIndexMismatchException, IllegalArgumentException
IndexercreateIndexingContext in interface Indexerid - the ID of the context.repositoryId - the ID of the repository that this context represents. You might have several contexts
indexing same repository ID, but on separate locations.repository - the location of the repository on FS.indexDirectory - the location of the Lucene indexes on FS.repositoryUrl - the location of the remote repository or null if this indexing context does not need
remote updates (is not a proxy).indexUpdateUrl - the alternate location of the remote repository indexes (if they are not in default place)
or null if defaults are applicable.searchable - if context should be searched in non-targeted mode.reclaim - if indexDirectory is known to contain (or should contain) valid Maven Indexer lucene index, and no
checks needed to be performed, or, if we want to "stomp" over existing index (unsafe to do!).indexers - the set of indexers to apply to this context.IOException - in case of some serious IO problem.ExistingLuceneIndexMismatchException - 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. Never thrown if reclaim is true, as in that case, if
Lucene index exists but any of those criteria above are not met, the existing index is overwritten,
and equipped with proper descriptor silently.IllegalArgumentException - in case the supplied list of IndexCreators are having non-satisfiable
dependencies.public IndexingContext createMergedIndexingContext(String id, String repositoryId, File repository, File indexDirectory, boolean searchable, ContextMemberProvider membersProvider) throws IOException
IndexercreateMergedIndexingContext in interface Indexerid - the ID of the context.repositoryId - the ID of the repository that this context represents. You might have several contexts
indexing same repository ID, but on separate locations.repository - the location of the repository on FS.indexDirectory - the location of the Lucene indexes on FS.searchable - if context should be searched in non-targeted mode.membersProvider - the ContextMemberProvider, never null.IOException - in case of some serious IO problem.public void closeIndexingContext(IndexingContext context, boolean deleteFiles) throws IOException
IndexercloseIndexingContext in interface Indexercontext - the one needed to be closed, never null.deleteFiles - true if all indexer related files (including Lucene index!) needs to be deleted,
false otherwise.IOExceptionpublic void addArtifactToIndex(ArtifactContext ac, IndexingContext context) throws IOException
IndexeraddArtifactToIndex in interface IndexerIOExceptionpublic void addArtifactsToIndex(Collection<ArtifactContext> ac, IndexingContext context) throws IOException
IndexeraddArtifactsToIndex in interface IndexerIOExceptionpublic void deleteArtifactsFromIndex(Collection<ArtifactContext> ac, IndexingContext context) throws IOException
IndexerdeleteArtifactsFromIndex in interface IndexerIOExceptionpublic FlatSearchResponse searchFlat(FlatSearchRequest request) throws IOException
IndexersearchFlat in interface IndexerIOExceptionpublic IteratorSearchResponse searchIterator(IteratorSearchRequest request) throws IOException
IndexersearchIterator in interface IndexerIOExceptionpublic GroupedSearchResponse searchGrouped(GroupedSearchRequest request) throws IOException
IndexersearchGrouped in interface IndexerIOExceptionpublic Collection<ArtifactInfo> identify(File artifact, Collection<IndexingContext> contexts) throws IOException
IndexerFile will have SHA1 hash calculated, and an
Indexer.identify(Query, Collection) method will be invoked searching with calculated hash the MAVEN.SHA1
field. This is just a shorthand method, as these calls are simply calculating hex encoded SHA1 of the file, and
invoking the Indexer.constructQuery(Field, SearchExpression) and Indexer.identify(Query, Collection) methods.identify in interface Indexerartifact - the filecontexts - in which to perform the actionIOExceptionpublic Collection<ArtifactInfo> identify(org.apache.lucene.search.Query query, Collection<IndexingContext> contexts) throws IOException
IndexerMAVEN.SHA1 or such.identify in interface IndexerIOExceptionpublic org.apache.lucene.search.Query constructQuery(Field field, SearchExpression expression) throws IllegalArgumentException
IndexerconstructQuery in interface IndexerIllegalArgumentExceptionSearchExpression,
UserInputSearchExpression,
SourcedSearchExpressionpublic org.apache.lucene.search.Query constructQuery(Field field, String expression, SearchType searchType) throws IllegalArgumentException
IndexerconstructQuery in interface IndexerIllegalArgumentExceptionCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.