mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r1490505 - in /mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc: ./ MultipleFieldsDocument.java NumericFieldDocument.java SingleFieldDocument.java UnstoredFieldsDocument.java
Date Fri, 07 Jun 2013 04:20:09 GMT
Author: gsingers
Date: Fri Jun  7 04:20:08 2013
New Revision: 1490505

URL: http://svn.apache.org/r1490505
Log:
MAHOUT-944: this is getting ridiculous

Added:
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/NumericFieldDocument.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/SingleFieldDocument.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java

Added: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java?rev=1490505&view=auto
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
(added)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/MultipleFieldsDocument.java
Fri Jun  7 04:20:08 2013
@@ -0,0 +1,43 @@
+package org.apache.mahout.text.doc;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+
+/**
+ * Used for testing lucene2seq
+ */
+public class MultipleFieldsDocument extends SingleFieldDocument {
+
+  public static final String FIELD1 = "field1";
+  public static final String FIELD2 = "field2";
+
+  private String field1;
+  private String field2;
+
+  public MultipleFieldsDocument(String id, String field, String field1, String field2) {
+    super(id, field);
+    this.field1 = field1;
+    this.field2 = field2;
+  }
+
+  public String getField1() {
+    return field1;
+  }
+
+  public String getField2() {
+    return field2;
+  }
+
+  @Override
+  public Document asLuceneDocument() {
+    Document document = super.asLuceneDocument();
+
+    Field field1 = new Field(FIELD1, this.field1, Field.Store.YES, Field.Index.ANALYZED);
+    Field field2 = new Field(FIELD2, this.field2, Field.Store.YES, Field.Index.ANALYZED);
+
+    document.add(field1);
+    document.add(field2);
+
+    return document;
+  }
+}

Added: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/NumericFieldDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/NumericFieldDocument.java?rev=1490505&view=auto
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/NumericFieldDocument.java
(added)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/NumericFieldDocument.java
Fri Jun  7 04:20:08 2013
@@ -0,0 +1,38 @@
+package org.apache.mahout.text.doc;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.IntField;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+
+
+/**
+ * Document with numeric field.
+ */
+public class NumericFieldDocument extends SingleFieldDocument {
+
+  public static final String NUMERIC_FIELD = "numeric";
+
+  private int numericField;
+
+  public NumericFieldDocument(String id, String field, int numericField) {
+    super(id, field);
+    this.numericField = numericField;
+  }
+
+  @Override
+  public Document asLuceneDocument() {
+    Document document = new Document();
+
+    document.add(new StringField(ID_FIELD, getId(), Field.Store.YES));
+    document.add(new TextField(FIELD, getField(), Field.Store.YES));
+    document.add(new IntField(NUMERIC_FIELD, numericField, Field.Store.YES));
+
+    return document;
+  }
+
+  public int getNumericField() {
+    return numericField;
+  }
+}

Added: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/SingleFieldDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/SingleFieldDocument.java?rev=1490505&view=auto
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/SingleFieldDocument.java
(added)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/SingleFieldDocument.java
Fri Jun  7 04:20:08 2013
@@ -0,0 +1,43 @@
+package org.apache.mahout.text.doc;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+
+/**
+ * Used for testing lucene2seq
+ */
+public class SingleFieldDocument {
+
+  public static final String ID_FIELD = "idField";
+  public static final String FIELD = "field";
+
+  private String id;
+  private String field;
+
+  public SingleFieldDocument(String id, String field) {
+    this.id = id;
+    this.field = field;
+  }
+
+  public String getId() {
+    return id;
+  }
+
+  public String getField() {
+    return field;
+  }
+
+  public Document asLuceneDocument() {
+    Document document = new Document();
+
+    Field idField = new StringField(ID_FIELD, getId(), Field.Store.YES);
+    Field field = new TextField(FIELD, getField(), Field.Store.YES);
+
+    document.add(idField);
+    document.add(field);
+
+    return document;
+  }
+}

Added: mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java?rev=1490505&view=auto
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
(added)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/text/doc/UnstoredFieldsDocument.java
Fri Jun  7 04:20:08 2013
@@ -0,0 +1,27 @@
+package org.apache.mahout.text.doc;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+
+/**
+ * Used for testing lucene2seq
+ */
+public class UnstoredFieldsDocument extends SingleFieldDocument {
+
+  public static final String UNSTORED_FIELD = "unstored";
+
+  public UnstoredFieldsDocument(String id, String field) {
+    super(id, field);
+  }
+
+  @Override
+  public Document asLuceneDocument() {
+    Document document = super.asLuceneDocument();
+
+    Field unstoredField = new Field(UNSTORED_FIELD, "", Field.Store.NO, Field.Index.NOT_ANALYZED);
+
+    document.add(unstoredField);
+
+    return document;
+  }
+}



Mime
View raw message