You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Liaqat Ali <li...@gmail.com> on 2007/11/29 09:25:24 UTC

Problem with Add method

This code generate error, kindly tell me that what parameters will be 
use when we use constructors.

Document doc = new Document();
      doc.add( Field.Keyword("id", keywords[i]));
      doc.add( Field.UnIndexed("country", unindexed[i]));
      doc.add(Field.UnStored("contents", unstored[i]));
      doc.add( Field.Text("city", text[i]));
      writer.addDocument(doc);


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Problem with Add method

Posted by Shai Erera <se...@gmail.com>.
Which Lucene version do you use?
If it's 2.2, then Field.Keyword, Field.UnIndexed etc. we removed.
You should instead do:

Document doc = new Document();
     doc.add(new Field("id", keywords[i], Store.NO, Index.UN_TOKENIZED));
     doc.add(new Field("country", unindexed[i], Store.YES,
Index.UN_TOKENIZED));
etc...

On Nov 29, 2007 10:25 AM, Liaqat Ali <li...@gmail.com> wrote:

> This code generate error, kindly tell me that what parameters will be
> use when we use constructors.
>
> Document doc = new Document();
>      doc.add( Field.Keyword("id", keywords[i]));
>      doc.add( Field.UnIndexed("country", unindexed[i]));
>      doc.add(Field.UnStored("contents", unstored[i]));
>      doc.add( Field.Text("city", text[i]));
>      writer.addDocument(doc);
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Regards,

Shai Erera