lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Pieper <>
Subject Changes at Field.Text()
Date Thu, 05 Oct 2006 20:33:43 GMT
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]));


-- Jan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message