lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject RE: Real time indexing with RAMDirectory
Date Wed, 11 May 2005 19:38:02 GMT
What happens if you swap these 2 lines?

		System.out.println("Docs number : " + ir.numDocs());
		ir.close();

If I were you, I'd try using minMergeDocs instead of RAMDirectory.  It
makes things much simpler.  You shouldn't need to optimize the index.


Otis

--- Rifflard MickaŽl <Mickael.Rifflard@atosorigin.com> wrote:
> Hi Otis,
> 
> My question was too much short cut. 
> 
> Here is a sample : 
> 
> import org.apache.lucene.index.IndexWriter;
> import org.apache.lucene.index.IndexReader;
> import org.apache.lucene.store.RAMDirectory;
> import org.apache.lucene.analysis.standard.StandardAnalyzer;
> import java.io.IOException;
> 
> public class MySample {
> 	public static void main(String[] args) {
> 		try {
> 			RAMDirectory ramd = new RAMDirectory();
> 			IndexWriter iw = new IndexWriter(ramd,new
> StandardAnalyzer(),true);
> 			iw.minMergeDocs = 1;
> 			iw.addDocument(new org.apache.lucene.document.Document());
>    
> 			IndexReader ir = IndexReader.open(ramd);
> 			System.out.println("Docs number : " + ir.numDocs());
> 			ir.close();
> 			iw.close();
> 		}
> 		catch (IOException ioe) { ioe.printStackTrace(); }
> 	}
> }
> 
> If I execute this sample, the result is : 
> 
> Docs number : 0
> 
> If a call close() method or optimize() method after added my
> document, the result is :
> 
> Docs number : 1
> 
> So, my question is : How to get the second result without close() or
> optimize() index 
> (expensive methods I think) ?
> 
> Thanks,
> 
> 	MickaŽl
> 
> 
> 
> -----Message d'origine-----
> De : Otis Gospodnetic [mailto:otis_gospodnetic@yahoo.com]
> Envoyť : mardi 10 mai 2005 17:39
> ņ : java-user@lucene.apache.org
> Objet : Re: Real time indexing with RAMDirectory
> 
> 
> Hi MickaŽl,
> 
> Have you tried using minMergeDocs=1 ?  Will that do what you want?
> 
> Otis
> 
> --- Rifflard MickaŽl <Mickael.Rifflard@atosorigin.com> wrote:
> > Hi all,
> > 
> > Is it possible, with the RAMDirectory (or another Directory), to
> > "flush" informations after each Document indexing ?
> > I tried this but this "flush" appears to be able to be made after 2
> > indexing at best.
> > 
> > What do you think about it ? I forgot a configuration ?
> > 
> > Thanks,
> >  
> > 	MickaŽl
> > 
> >
> ---------------------------------------------------------------------
> > 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
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message