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 Wenhao Xu <xu...@gmail.com> on 2009/11/10 07:39:15 UTC

Index maintaining/updating

Hi, everybody,
   I am new to Lucene and have a question about how to update my index. The
following is my situation:
   1) I create indexes for each text (or varchar) field of a relational
database;
   2) This database will be continuously inserted into by new records; and I
need to add indexes of these new records to the index;
   So therefore, I just need to incrementally update my index. Should I
delete the original index an rebuild a new one? Or just update the new one?
Which method is better for my situation?

    I searched google, but I did not get a good answer. So I posted the
question here. Looking forward to your reply.

Thanks,
W.



-- 
~_~

Re: Index maintaining/updating

Posted by Wenhao Xu <xu...@gmail.com>.
Thanks, guys. It helps a lot!

W.

On Mon, Nov 9, 2009 at 11:35 PM, Anshum <an...@gmail.com> wrote:

> Hi Wenhao,
> Its generally better to incrementally buld your index and at the same
> tiime.
> Considering by this time you'd be a little aware of implementing/using
> luceneAPI, here is what you could do.
> Open the existing index using 'createnew' set to false
>
> *IndexWriter(Directory d, Analyzer a, boolean create) *
> *This way, the indexwriter would append the new documents to the existing
> index (as specified in the IndexWriter constructor).*
> *
> *
> *This way you could incrementally build the index.*
> *Also note, you may wish to optimize the index at times.*
> *
> *
> *Hope this solves your issue (and doubt).*
> *
> *--
> Anshum Gupta
> Naukri Labs!
> http://ai-cafe.blogspot.com
>
> The facts expressed here belong to everybody, the opinions to me. The
> distinction is yours to draw............
>
>
> On Tue, Nov 10, 2009 at 12:09 PM, Wenhao Xu <xu...@gmail.com>
> wrote:
>
> > Hi, everybody,
> >   I am new to Lucene and have a question about how to update my index.
> The
> > following is my situation:
> >   1) I create indexes for each text (or varchar) field of a relational
> > database;
> >   2) This database will be continuously inserted into by new records; and
> I
> > need to add indexes of these new records to the index;
> >   So therefore, I just need to incrementally update my index. Should I
> > delete the original index an rebuild a new one? Or just update the new
> one?
> > Which method is better for my situation?
> >
> >    I searched google, but I did not get a good answer. So I posted the
> > question here. Looking forward to your reply.
> >
> > Thanks,
> > W.
> >
> >
> >
> > --
> > ~_~
> >
>



-- 
~_~

Re: Index maintaining/updating

Posted by Anshum <an...@gmail.com>.
Hi Wenhao,
Its generally better to incrementally buld your index and at the same
tiime.
Considering by this time you'd be a little aware of implementing/using
luceneAPI, here is what you could do.
Open the existing index using 'createnew' set to false

*IndexWriter(Directory d, Analyzer a, boolean create) *
*This way, the indexwriter would append the new documents to the existing
index (as specified in the IndexWriter constructor).*
*
*
*This way you could incrementally build the index.*
*Also note, you may wish to optimize the index at times.*
*
*
*Hope this solves your issue (and doubt).*
*
*--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Tue, Nov 10, 2009 at 12:09 PM, Wenhao Xu <xu...@gmail.com> wrote:

> Hi, everybody,
>   I am new to Lucene and have a question about how to update my index. The
> following is my situation:
>   1) I create indexes for each text (or varchar) field of a relational
> database;
>   2) This database will be continuously inserted into by new records; and I
> need to add indexes of these new records to the index;
>   So therefore, I just need to incrementally update my index. Should I
> delete the original index an rebuild a new one? Or just update the new one?
> Which method is better for my situation?
>
>    I searched google, but I did not get a good answer. So I posted the
> question here. Looking forward to your reply.
>
> Thanks,
> W.
>
>
>
> --
> ~_~
>

Re: Index maintaining/updating

Posted by hyj <ho...@163.com>.
Wenhao Xu,您好!

	Index.AddDocment(Docment doc)  can do your work. After the previous action,  remember to commit the Index.

======= 2009-11-10 14:40:03 您在来信中写道:=======

>Hi, everybody,
>   I am new to Lucene and have a question about how to update my index. The
>following is my situation:
>   1) I create indexes for each text (or varchar) field of a relational
>database;
>   2) This database will be continuously inserted into by new records; and I
>need to add indexes of these new records to the index;
>   So therefore, I just need to incrementally update my index. Should I
>delete the original index an rebuild a new one? Or just update the new one?
>Which method is better for my situation?
>
>    I searched google, but I did not get a good answer. So I posted the
>question here. Looking forward to your reply.
>
>Thanks,
>W.
>
>
>
>-- 
>~_~
>

= = = = = = = = = = = = = = = = = = = =
			

        致
礼!
 
				 
        hyj
        hongyinjie@163.com
          2009-11-10