lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r830775 - in /lucene/java/branches/lucene_2_9/contrib: CHANGES.txt instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
Date Wed, 28 Oct 2009 22:04:14 GMT
Author: uschindler
Date: Wed Oct 28 22:04:14 2009
New Revision: 830775

URL: http://svn.apache.org/viewvc?rev=830775&view=rev
Log:
LUCENE-1954: Fix ClassCastException in InitiatedIndexWriter on casting NumericField to Field

Modified:
    lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
    lucene/java/branches/lucene_2_9/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java

Modified: lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/contrib/CHANGES.txt?rev=830775&r1=830774&r2=830775&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/contrib/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/contrib/CHANGES.txt Wed Oct 28 22:04:14 2009
@@ -1,5 +1,13 @@
 Lucene contrib change Log
 
+======================= 2.9 Branch (not yet released) ==================
+
+Bug fixes
+
+ * LUCENE-1954: InstantiatedIndexWriter: Fixed ClassCastException with
+   NumericField because of incorrect unchecked cast: Document.getFields()
+   returns List<Fieldable>.  (Bernd Fondermann via Uwe Schindler)
+
 ======================= Release 2.9.1 2009-10-30 =======================
 
 Changes in backwards compatibility policy

Modified: lucene/java/branches/lucene_2_9/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=830775&r1=830774&r2=830775&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
(original)
+++ lucene/java/branches/lucene_2_9/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
Wed Oct 28 22:04:14 2009
@@ -36,7 +36,7 @@
 import org.apache.lucene.analysis.Token;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Fieldable;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
@@ -455,7 +455,7 @@
     // normalize settings per field name in document
 
     Map<String /* field name */, FieldSetting> fieldSettingsByFieldName = new HashMap<String,
FieldSetting>();
-    for (Field field : (List<Field>) document.getDocument().getFields()) {
+    for (Fieldable field : (List<Fieldable>) document.getDocument().getFields()) {
       FieldSetting fieldSetting = fieldSettingsByFieldName.get(field.name());
       if (fieldSetting == null) {
         fieldSetting = new FieldSetting();
@@ -499,12 +499,12 @@
       }
     }
 
-    Map<Field, LinkedList<Token>> tokensByField = new LinkedHashMap<Field,
LinkedList<Token>>(20);
+    Map<Fieldable, LinkedList<Token>> tokensByField = new LinkedHashMap<Fieldable,
LinkedList<Token>>(20);
 
     // tokenize indexed fields.
-    for (Iterator<Field> it = (Iterator<Field>) document.getDocument().getFields().iterator();
it.hasNext();) {
+    for (Iterator<Fieldable> it = (Iterator<Fieldable>) document.getDocument().getFields().iterator();
it.hasNext();) {
 
-      Field field = it.next();
+      Fieldable field = it.next();
 
       FieldSetting fieldSetting = fieldSettingsByFieldName.get(field.name());
 
@@ -554,7 +554,7 @@
     termDocumentInformationFactoryByDocument.put(document, termDocumentInformationFactoryByTermTextAndFieldSetting);
 
     // build term vector, term positions and term offsets
-    for (Map.Entry<Field, LinkedList<Token>> eField_Tokens : tokensByField.entrySet())
{
+    for (Map.Entry<Fieldable, LinkedList<Token>> eField_Tokens : tokensByField.entrySet())
{
       FieldSetting fieldSetting = fieldSettingsByFieldName.get(eField_Tokens.getKey().name());
 
       Map<String, TermDocumentInformationFactory> termDocumentInformationFactoryByTermText
= termDocumentInformationFactoryByTermTextAndFieldSetting.get(fieldSettingsByFieldName.get(eField_Tokens.getKey().name()));



Mime
View raw message