mirror of https://github.com/apache/lucene.git
start using the new Field API in the test cases
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150487 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
891a32f0b1
commit
a012f7cbfc
|
@ -140,14 +140,14 @@ public class TestDocument extends TestCase
|
||||||
private Document makeDocumentWithFields()
|
private Document makeDocumentWithFields()
|
||||||
{
|
{
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.add(Field.Keyword( "keyword", "test1"));
|
doc.add(new Field( "keyword", "test1", Field.Store.YES, Field.Index.UN_TOKENIZED));
|
||||||
doc.add(Field.Keyword( "keyword", "test2"));
|
doc.add(new Field( "keyword", "test2", Field.Store.YES, Field.Index.UN_TOKENIZED));
|
||||||
doc.add(new Field( "text", "test1", Field.Store.YES, Field.Index.TOKENIZED));
|
doc.add(new Field( "text", "test1", Field.Store.YES, Field.Index.TOKENIZED));
|
||||||
doc.add(new Field( "text", "test2", Field.Store.YES, Field.Index.TOKENIZED));
|
doc.add(new Field( "text", "test2", Field.Store.YES, Field.Index.TOKENIZED));
|
||||||
doc.add(Field.UnIndexed("unindexed", "test1"));
|
doc.add(new Field("unindexed", "test1", Field.Store.YES, Field.Index.NO));
|
||||||
doc.add(Field.UnIndexed("unindexed", "test2"));
|
doc.add(new Field("unindexed", "test2", Field.Store.YES, Field.Index.NO));
|
||||||
doc.add(Field.UnStored( "unstored", "test1"));
|
doc.add(new Field( "unstored", "test1", Field.Store.NO, Field.Index.TOKENIZED));
|
||||||
doc.add(Field.UnStored( "unstored", "test2"));
|
doc.add(new Field( "unstored", "test2", Field.Store.NO, Field.Index.TOKENIZED));
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ public class TestDateFilter
|
||||||
|
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
// add time that is in the past
|
// add time that is in the past
|
||||||
doc.add(Field.Keyword("datefield", DateField.timeToString(now - 1000)));
|
doc.add(new Field("datefield", DateField.timeToString(now - 1000), Field.Store.YES, Field.Index.UN_TOKENIZED));
|
||||||
doc.add(Field.Text("body", "Today is a very sunny day in New York City"));
|
doc.add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
writer.optimize();
|
writer.optimize();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -117,8 +117,8 @@ public class TestDateFilter
|
||||||
|
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
// add time that is in the future
|
// add time that is in the future
|
||||||
doc.add(Field.Keyword("datefield", DateField.timeToString(now + 888888)));
|
doc.add(new Field("datefield", DateField.timeToString(now + 888888), Field.Store.YES, Field.Index.UN_TOKENIZED));
|
||||||
doc.add(Field.Text("body", "Today is a very sunny day in New York City"));
|
doc.add(new Field("body", "Today is a very sunny day in New York City", Field.Store.YES, Field.Index.TOKENIZED));
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
writer.optimize();
|
writer.optimize();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
Loading…
Reference in New Issue