lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Seth Rosen <s...@architexa.com>
Subject Re: adding documents to an existing index
Date Wed, 27 Oct 2010 13:34:23 GMT
Yakob,
Here is a snippet of an example of IndexWriter from the lucene source that
you might find helpful.


> IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR), new
> StandardAnalyzer(Version.LUCENE_CURRENT), true,
> IndexWriter.MaxFieldLength.LIMITED);

System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");

indexDocs(writer, docDir);

System.out.println("Optimizing...");

writer.optimize();

writer.close();


Seth Rosen
www.architexa.com
Understand & Document Code In Seconds
seth@architexa.com <vineet@architexa.com>



2010/10/27 Yakob <jacobian@opensuse-id.org>

> well thanks anyway though.
>
> On 10/27/10, 蒋明原 <mailtojiangmingyuan@gmail.com> wrote:
> > you are too lazy.download the lucene source code,take a glance and you
> will
> > find demos;
> >
> > On Wed, Oct 27, 2010 at 8:43 PM, Yakob <jacobian@opensuse-id.org> wrote:
> >
> >> I did searched about this constructor and find that it's already been
> >> deprecated.
> >>
> >>
> http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/index/IndexWriter.html#IndexWriter(org.apache.lucene.store.Directory
> >> ,
> >> org.apache.lucene.analysis.Analyzer, boolean)
> >>
> >> I am using lucene 3.0 now.can I really use this constructor or I
> >> should try it first? btw I would appreciate if you gave me a code
> >> sample though. thanks. :-)
> >>
> >> On 10/27/10, 蒋明原 <mailtojiangmingyuan@gmail.com> wrote:
> >> > IndexWriter writer =new IndexWirter(path,analyzer,false);
> >> >
> >> > the 3rd parameter is what you want.
> >> > than you can
> >> >
> >> > writer.add(doc)
> >> >
> >> > enjoy .
> >> >
> >>
> >> --
> >> http://jacobian.web.id
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
>
>
> --
> http://jacobian.web.id
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message