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 "m.harig" <m....@gmail.com> on 2009/12/04 11:30:59 UTC

updating index

hello all

        how do i update my existing index to avoid my duplicates , this is
how am doing my indexing

   doc.add(new Field("id",""+i,Field.Store.YES,Field.Index.NOT_ANALYZED));
                       
   doc.add(new Field("title", indexForm.getTitle(), Field.Store.YES,
                                        Field.Index.ANALYZED));
   doc.add(new Field("contents", indexForm.getContent(),
                Field.Store.YES, Field.Index.ANALYZED));
   writer.updateDocument(new Term("id"), doc);

   but i've no luck , the index getting duplicate documents , how do i
handle it? please anyone help me?
-- 
View this message in context: http://old.nabble.com/updating-index-tp26635841p26635841.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: updating index

Posted by Ian Lea <ia...@gmail.com>.
writer.updateDocument(new Term("id", ""+i), doc);

Read the javadocs!  Haven't we been here before?


--
Ian.


On Fri, Dec 4, 2009 at 10:30 AM, m.harig <m....@gmail.com> wrote:
>
> hello all
>
>        how do i update my existing index to avoid my duplicates , this is
> how am doing my indexing
>
>   doc.add(new Field("id",""+i,Field.Store.YES,Field.Index.NOT_ANALYZED));
>
>   doc.add(new Field("title", indexForm.getTitle(), Field.Store.YES,
>                                        Field.Index.ANALYZED));
>   doc.add(new Field("contents", indexForm.getContent(),
>                Field.Store.YES, Field.Index.ANALYZED));
>   writer.updateDocument(new Term("id"), doc);
>
>   but i've no luck , the index getting duplicate documents , how do i
> handle it? please anyone help me?
> --
> View this message in context: http://old.nabble.com/updating-index-tp26635841p26635841.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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