mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smar...@apache.org
Subject svn commit: r1542647 - /mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
Date Sun, 17 Nov 2013 05:14:56 GMT
Author: smarthi
Date: Sun Nov 17 05:14:56 2013
New Revision: 1542647

URL: http://svn.apache.org/r1542647
Log:
MAHOUT-1343: Replaced deprecated Lucene 3.x API with equivalent Lucene 4.x API.

Modified:
    mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java?rev=1542647&r1=1542646&r2=1542647&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
(original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
Sun Nov 17 05:14:56 2013
@@ -27,6 +27,8 @@ import org.apache.hadoop.fs.Path;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.Version;
@@ -101,12 +103,18 @@ public final class TestClusterDumper ext
     try {
       for (int i = 0; i < docs2.length; i++) {
         Document doc = new Document();
-        Field id = new Field("id", "doc_" + i, Field.Store.YES,
-            Field.Index.NOT_ANALYZED_NO_NORMS);
+        Field id = new StringField("id", "doc_" + i, Field.Store.YES);
         doc.add(id);
         // Store both position and offset information
-        Field text = new Field("content", docs2[i], Field.Store.NO,
-            Field.Index.ANALYZED, Field.TermVector.YES);
+        FieldType fieldType = new FieldType();
+        fieldType.setStored(false);
+        fieldType.setIndexed(true);
+        fieldType.setTokenized(true);
+        fieldType.setStoreTermVectors(true);
+        fieldType.setStoreTermVectorPositions(true);
+        fieldType.setStoreTermVectorOffsets(true);
+        fieldType.freeze();
+        Field text = new Field("content", docs2[i], fieldType);
         doc.add(text);
         writer.addDocument(doc);
       }



Mime
View raw message