Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINDEXER-66 provided a way to customize IndexWriterConfig

Introduced protected DefaultNexusIndexer#getWriterConfig() which
allows DefaultNexusIndexer subclasses customize writer configuration
as necessary.

Introduced NexusIndexer#addIndexingContext(IndexingContext) which
allows adding custom context implementations to the indexer.

Updated version to 5.1.0-SNAPSHOT to signify introduction of new
API methods.

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Signed-off-by: Tamás Cservenák <cstamas@apache.org>

git-svn-id: https://svn.apache.org/repos/asf/maven/indexer/trunk@1410255 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 1de379012e36ea3abfaa1fbb8d1fba17a74593a6 1 parent 44451f5
@cstamas cstamas authored
View
7 indexer-core/src/main/java/org/apache/maven/index/DefaultNexusIndexer.java
@@ -74,7 +74,7 @@
@Requirement
private QueryCreator queryCreator;
- private Map<String, IndexingContext> indexingContexts;
+ private final Map<String, IndexingContext> indexingContexts;
public DefaultNexusIndexer()
{
@@ -85,6 +85,11 @@ public DefaultNexusIndexer()
// Contexts
// ----------------------------------------------------------------------------
+ public void addIndexingContext( IndexingContext context )
+ {
+ indexingContexts.put( context.getId(), context );
+ };
+
public IndexingContext addIndexingContext( String id, String repositoryId, File repository, File indexDirectory,
String repositoryUrl, String indexUpdateUrl,
List<? extends IndexCreator> indexers )
View
7 indexer-core/src/main/java/org/apache/maven/index/NexusIndexer.java
@@ -91,6 +91,13 @@
/**
* Adds an indexing context to Nexus indexer.
*
+ * @since 5.1.0
+ */
+ void addIndexingContext( IndexingContext context );
+
+ /**
+ * Adds an indexing context to Nexus indexer.
+ *
* @param id the ID of the context.
* @param repositoryId the ID of the repository that this context represents.
* @param repository the location of the repository.
View
13 indexer-core/src/main/java/org/apache/maven/index/context/DefaultIndexingContext.java
@@ -469,12 +469,21 @@ protected void openAndWarmup()
searcherManager = null;
}
- final IndexWriterConfig config = NexusIndexWriter.defaultConfig();
- this.indexWriter = new NexusIndexWriter( getIndexDirectory(), config );
+ this.indexWriter = new NexusIndexWriter( getIndexDirectory(), getWriterConfig() );
this.indexWriter.commit(); // LUCENE-2386
this.searcherManager = new SearcherManager( indexWriter, false, new NexusIndexSearcherFactory( this ) );
}
+ /**
+ * Returns new IndexWriterConfig instance
+ *
+ * @since 5.1
+ */
+ protected IndexWriterConfig getWriterConfig()
+ {
+ return NexusIndexWriter.defaultConfig();
+ }
+
public IndexWriter getIndexWriter()
throws IOException
{
Please sign in to comment.
Something went wrong with that request. Please try again.