I'm trying to get some relatively old Lucene code to compile (please see
below), and it appears that Field.Text has been deprecated. Can someone please
suggest what I should use in its place?
Thank you.
Lindsey
public static void main(String args[]) throws Exception
{
String indexDir =
System.getProperty("java.io.tmpdir", "tmp") +
System.getProperty("file.separator") + "address-book";
Analyzer analyzer = new WhitespaceAnalyzer();
boolean createFlag = true;
IndexWriter writer = new IndexWriter(indexDir, analyzer, createFlag);
Document contactDocument = new Document();
contactDocument.add(Field.Text("type", "individual"));
contactDocument.add(Field.Text("name", "Zane Pasolini"));
contactDocument.add(Field.Text("address", "999 W. Prince St."));
contactDocument.add(Field.Text("city", "New York"));
contactDocument.add(Field.Text("province", "NY"));
contactDocument.add(Field.Text("postalcode", "10013"));
contactDocument.add(Field.Text("country", "USA"));
contactDocument.add(Field.Text("telephone", "1-212-345-6789"));
writer.addDocument(contactDocument);
writer.close();
}
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel
and lay it on us.