1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.index.context;
20
21 import java.io.IOException;
22
23 import org.apache.lucene.analysis.Analyzer;
24 import org.apache.lucene.index.CorruptIndexException;
25 import org.apache.lucene.index.IndexWriter;
26 import org.apache.lucene.index.IndexWriterConfig;
27 import org.apache.lucene.index.SerialMergeScheduler;
28 import org.apache.lucene.store.Directory;
29 import org.apache.lucene.store.LockObtainFailedException;
30
31
32
33
34
35
36 public class NexusIndexWriter extends IndexWriter {
37 public interface IndexWriterConfigFactory {
38 IndexWriterConfig create(Analyzer analyzer);
39 }
40
41 @Deprecated
42 public NexusIndexWriter(final Directory directory, final Analyzer analyzer, boolean create)
43 throws CorruptIndexException, LockObtainFailedException, IOException {
44 this(directory, new IndexWriterConfig(analyzer));
45 }
46
47 public NexusIndexWriter(final Directory directory, final IndexWriterConfig config)
48 throws CorruptIndexException, LockObtainFailedException, IOException {
49 super(directory, config);
50 }
51
52
53
54 public static IndexWriterConfig defaultConfig() {
55 final IndexWriterConfig config = new IndexWriterConfig(new NexusAnalyzer());
56
57 config.setRAMBufferSizeMB(2.0);
58 config.setMergeScheduler(new SerialMergeScheduler());
59 return config;
60 }
61 }