I am new to Java and Lucene and I bought a book about Java Lucene and
there is
an example which does not function because Field.Text(String, String) is
deprecated now. What I have to do now?
Here is the code:
--------------------------------------------------------------------------------
import org.apache.lucene.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.document.*;
import org.apache.lucene.index.*;
import org.apache.lucene.analysis.standard.*;
class CreateIndex
{
public static void main(String[] args) throws Exception
{
String[] text = {
"This is only a small test",
"This is another small test"
};
String indexDir = "index/test";
Analyzer analyser = new StandardAnalyzer();
boolean create = true;
IndexWriter writer = new IndexWriter(indexDir, analyser, create);
for(int i=0; i<text.length; i++)
{
Document document = new Document();
document.add(Field.Text("textfield", text[i]));
writer.addDocument(document);
}
writer.close();
}
}
--------------------------------------------------------------------------------
-- Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]