Package org.apache.mahout.text.doc

Examples of org.apache.mahout.text.doc.SingleFieldDocument


    lucene2Seq.run(lucene2SeqConf);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testIndexedButNotStoredField() throws IOException {
    SingleFieldDocument document = new SingleFieldDocument("id", "field") {
      @Override
      public Document asLuceneDocument() {
        Document document = super.asLuceneDocument();
        document.add(new TextField("indexed", "This text is indexed", Field.Store.NO));
        return document;
      }
    };
    commitDocuments(getDirectory(getIndexPath1AsFile()), document);
View Full Code Here


    assertEquals(new Integer(maxHits), (Integer) lucene2SeqConf.getMaxHits());
  }

  @Test
  public void testRunOptionalArguments() throws Exception {
    commitDocuments(getDirectory(getIndexPath1AsFile()), new SingleFieldDocument("1", "Mahout is cool"));
    commitDocuments(getDirectory(getIndexPath1AsFile()), new SingleFieldDocument("2", "Mahout is cool"));

    String[] args = {
      "-i", getIndexPath1AsFile().toString(),
      "-o", seqFilesOutputPath.toString(),
      "-id", idField,
View Full Code Here

    assertEquals(SequenceFilesFromLuceneStorageDriver.DEFAULT_MAX_HITS, lucene2SeqConf.getMaxHits());
  }

  @Test
  public void testRunInvalidQuery() throws Exception {
    commitDocuments(getDirectory(getIndexPath1AsFile()), new SingleFieldDocument("1", "Mahout is cool"));
    commitDocuments(getDirectory(getIndexPath1AsFile()), new SingleFieldDocument("2", "Mahout is cool"));

    String[] args = {
      "-i", getIndexPath1AsFile().toString(),
      "-o", seqFilesOutputPath.toString(),
      "-id", idField,
View Full Code Here

  public void setUp() throws Exception {
    super.setUp();
    indexPath1 = getTestTempDirPath("index1");
    indexPath2 = getTestTempDirPath("index2");
    for (int i = 0; i < 2000; i++) {
      docs.add(new SingleFieldDocument(String.valueOf(i), "This is test document " + i));
    }
    misshapenDocs.add(new SingleFieldDocument("", "This doc has an empty id"));
    misshapenDocs.add(new SingleFieldDocument("empty_value", ""));
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.text.doc.SingleFieldDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.