Field( String, String, Field.Store.YES, Field.Index.TOKENIZED ) is the
equivalent of the old Field.Text( String, String ) which was deprecated
in 1.9 and removed in 2.0.

This is really a java-user question.

-----Original Message-----
From: Jan Pieper [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 05, 2006 1:34 PM
To: java-dev@lucene.apache.org
Subject: Changes at Field.Text()

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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to