Upgrade doc indexer to Lucene 4.10

Change-Id: I1204d5c4ac3aee4bf9f0c8651975408811cbf583
This commit is contained in:
Dave Borowitz 2014-09-05 15:28:01 -07:00
parent f780397780
commit 2169e1fa7e
2 changed files with 3 additions and 7 deletions

View File

@ -31,7 +31,6 @@ import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Version;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -46,8 +45,6 @@ public class QueryDocumentationExecutor {
private static final Logger log =
LoggerFactory.getLogger(QueryDocumentationExecutor.class);
private static final Version LUCENE_VERSION = Version.LUCENE_48;
private IndexSearcher searcher;
private QueryParser parser;
@ -68,8 +65,7 @@ public class QueryDocumentationExecutor {
}
IndexReader reader = DirectoryReader.open(dir);
searcher = new IndexSearcher(reader);
StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
parser = new QueryParser(LUCENE_VERSION, Constants.DOC_FIELD, analyzer);
parser = new QueryParser(Constants.DOC_FIELD, new StandardAnalyzer());
} catch (IOException e) {
log.error("Cannot initialize documentation full text index", e);
searcher = null;

View File

@ -51,7 +51,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class DocIndexer {
private static final Version LUCENE_VERSION = Version.LUCENE_48;
private static final Version LUCENE_VERSION = Version.LUCENE_4_10_0;
private static final Pattern SECTION_HEADER = Pattern.compile("^=+ (.*)");
@Option(name = "-o", usage = "output JAR file")
@ -99,7 +99,7 @@ public class DocIndexer {
RAMDirectory directory = new RAMDirectory();
IndexWriterConfig config = new IndexWriterConfig(
LUCENE_VERSION,
new StandardAnalyzer(LUCENE_VERSION, CharArraySet.EMPTY_SET));
new StandardAnalyzer(CharArraySet.EMPTY_SET));
config.setOpenMode(OpenMode.CREATE);
IndexWriter iwriter = new IndexWriter(directory, config);
for (String inputFile : inputFiles) {