Apache Lucene open-source search software
LUCENE-1462 InstantiatedIndexWriter did not reset pre analyzed TokenStreams the same way IndexWriter does. Parts of InstantiatedIndex was not Serializable.
Karl-Johan Wettin219a20a9454d
diff --git a/contrib/CHANGES.txt b/contrib/CHANGES.txtindex 00138b71770..57fa8f7de98 100644--- a/contrib/CHANGES.txt+++ b/contrib/CHANGES.txt@@ -15,6 +15,10 @@ Bug fixes1. LUCENE-1423: InstantiatedTermEnum#skipTo(Term) throws ArrayIndexOutOfBounds on empty index.(Karl Wettin)+ 2. LUCENE-1462: InstantiatedIndexWriter did not reset pre analyzed TokenStreams the+ same way IndexWriter does. Parts of InstantiatedIndex was not Serializable.+ (Karl Wettin)+New features1. LUCENE-1470: Added TrieRangeQuery, a much faster implementation ofdiff --git a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.javaindex 34d96bf710c..f2af6767d9f 100644--- a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java+++ b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java@@ -1,5 +1,7 @@package org.apache.lucene.store.instantiated;+import java.io.Serializable;+/*** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with@@ -20,7 +22,7 @@ package org.apache.lucene.store.instantiated;/*** For non package access see {@link org.apache.lucene.index.IndexReader#getFieldNames(org.apache.lucene.index.IndexReader.FieldOption)}*/-class FieldSetting {+class FieldSetting implements Serializable {String fieldName;boolean storeTermVector = false;diff --git a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.javaindex 99b4ace7ad6..5659d3afca1 100644--- a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java+++ b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java@@ -3,6 +3,7 @@ package org.apache.lucene.store.instantiated;import java.util.HashMap;import java.util.Map;import java.util.Collection;+import java.io.Serializable;/*** Licensed to the Apache Software Foundation (ASF) under one or more@@ -24,7 +25,7 @@ import java.util.Collection;/*** Essetially a Map<FieldName, {@link org.apache.lucene.store.instantiated.FieldSetting}>*/-class FieldSettings {+class FieldSettings implements Serializable {FieldSettings() {diff --git a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.javaindex 307c16e9e76..4279163d547 100644--- a/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java+++ b/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java@@ -522,6 +522,9 @@ public class InstantiatedIndexWriter {tokenStream = analyzer.tokenStream(field.name(), new StringReader(field.stringValue()));}+ // reset the TokenStream to the first token+ tokenStream.reset();+final Token reusableToken = new Token();for (Token nextToken = tokenStream.next(reusableToken); nextToken != null; nextToken = tokenStream.next(reusableToken)) {tokens.add((Token) nextToken.clone()); // the vector will be built on commit.