Problem with Add method

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with Add method

Liaqat Ali-2
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problem with Add method

Shai Erera
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Regards,

Shai Erera