[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: batch indexing using RAMDirectory
From:       James Pine <general_nogi () yahoo ! com>
Date:       2006-06-28 19:42:37
Message-ID: 20060628194237.80952.qmail () web34114 ! mail ! mud ! yahoo ! com
[Download RAW message or body]

Hey Eric,

I think you want:

fsWriter.addIndexes(Directory[] {ramDir});

to be:

fsWriter.addIndexes(new Directory[]{ramDir});

JAMES


--- zheng <zheng@dcs.bbk.ac.uk> wrote:

> I am a novice in lucene. I write some code to do
> batch indexing using
> RAMDirectory according to the code provided in
> lucene in action, which is
> something like FSDirectory fsDir =
> FSDirectory.getDirectory("/tmp/index",
> 
> true);
> 
> RAMDirectory ramDir = new RAMDirectory();
> 
> IndexWriter fsWriter = IndexWriter(fsDir,
> 
> new SimpleAnalyzer(), true);
> 
> IndexWriter ramWriter = new IndexWriter(ramDir,
> 
> new SimpleAnalyzer(), true);
> 
> while (there are documents to index) {
> 
> ... create Document ...
> 
> ramWriter.addDocument(doc);
> 
> if (condition for flushing memory to disk has been
> met) {
> 
> fsWriter.addIndexes(Directory[] {ramDir});
> 
> ramWriter.close();
> 
> ramWriter = new IndexWriter(ramDir, new
> SimpleAnalyzer(),
> 
> true);
> 
> }
> 
> }
> 
> But it cannot compile correctly on
> fsWriter.addIndexes(Directory[]
> {ramDir}); It seems some problem with ramDir. Is
> there something changed at
> lucene 2.0? How can I implement batch indexing
> correctly? Any simple code. 
> 
> Thanks!
> 
>  
> 
> Eric
> 
>  
> 
>  
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic