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: Reusing an IndexWriter ?
Date Wed, 21 May 2003 20:52:09 GMT
Only 1 IndexWriter can write to the index at the time.
It should be easy to seralize index modifications by using
'synchronize' keyword with a method that wraps addDocument calls.

Otis

--- Guilherme Barile <gui@prosoma.com.br> wrote:
> I just finished changing my main class (which wraps lucene methods).
> Now
> I close my indexwriter every time I finish indexing, I also
> open/close
> my IndexReader and Searcher every time I search. Seem to be working. 
> As a curiosity, how would lucene work in a multi-user environment ?
> (multiple users indexing information at the same time on the same
> index)
> Did anyone ever wrote an IndexWriter connection pooler ?
> 
> Thanks a lot (again)
> 
> gui
> 
> On Wed, 2003-05-21 at 16:23, Otis Gospodnetic wrote:
> > --- Guilherme Barile <gui@prosoma.com.br> wrote:
> > > But if I start both an IndexReader and an IndexWriter on the
> program
> > > startup, and add documents to the index without closing it, the
> > > reader
> > > wouldn't be able to search it, will it ?
> > 
> > Correct.
> > 
> > > Can anyone show me the "safe way" do to it ?
> > 
> > Close the InderWriter when you are done indexing, and re-open
> > IndexReader/Searcher when you detect that the index changed in
> order to
> > 'see' new documents.
> > 
> > Otis
> > 
> > 
> > > thanks
> > > 
> > > On Wed, 2003-05-21 at 12:44, Aviran Mordo wrote:
> > > > You can create one instance of Container in your main
> application
> > > and
> > > > reuse it. Just don't forget to add a close method to it
> (Container)
> > > so
> > > > you can close the writer after you are done doing all the work.
> > > > 
> > > > Aviran
> > > > 
> > > > -----Original Message-----
> > > > From: Guilherme Barile [mailto:gui@prosoma.com.br] 
> > > > Sent: Wednesday, May 21, 2003 11:20 AM
> > > > To: Lucene Users List
> > > > Subject: RE: Reusing an IndexWriter ?
> > > > 
> > > > 
> > > > Probably, but not the way I'm using it.
> > > > I created a Container class that wraps lucene methods, I call
> it
> > > using
> > > > myindex = new Container(File); where File is the directory
> where
> > > the
> > > > index resides.
> > > > 
> > > > On Container's constructor, I create a writer and a reader, but
> I
> > > guess
> > > > I'll have to open a reader every time I search and a writer
> every
> > > time I
> > > > write to it, am I right ?
> > > > 
> > > > thanks again
> > > > 
> > > > gui
> > > > 
> > > > On Wed, 2003-05-21 at 11:35, Aviran Mordo wrote:
> > > > > You can keep the IndexWriter open until you quit the indexing
> 
> > > > > application. Then you'll need to close it.
> > > > > 
> > > > > Aviran
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Guilherme Barile [mailto:gui@prosoma.com.br]
> > > > > Sent: Wednesday, May 21, 2003 9:55 AM
> > > > > To: Lucene
> > > > > Subject: Reusing an IndexWriter ?
> > > > > 
> > > > > 
> > > > > Hello
> > > > > 	I just started using Lucene, and I'm writing a simple
> program
> > > > (swing
> > > > > interface) that adds files to an index (I'm not searching
> that
> > > index
> > > > > yet).
> > > > > 	In my main frame, I click a button, a FileChooser appears
> and I
> > > > > add the contents of the chosen file to this index... now,
> after
> > > adding
> > > > > this document, do I have to close my IndexWriter object ?
> > > > > 
> > > > > 	I just added a file and that's what I found on my index dir:
> > > > > 
> > > > > total 4
> > > > > -rw-r--r--    1 guigouz  users           8 May 21 10:49
> segments
> > > > > -rw-r--r--    1 guigouz  users           0 May 21 10:49
> > > write.lock
> > > > > 
> > > > > 	Isn't there some method to writeout the index without
> closing
> > > > the 
> > > > > IndexWriter ?
> > > > > 
> > > > > thanks in advance
> > > > > 
> > > > > gui
> > > > > 
> > > > > 
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > lucene-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > lucene-user-help@jakarta.apache.org
> > > > > 
> > > > > 
> > > > > 
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > lucene-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > > lucene-user-help@jakarta.apache.org
> > > > > 
> > > > 
> > > > 
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > lucene-user-help@jakarta.apache.org
> > > > 
> > > > 
> > > > 
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > lucene-user-help@jakarta.apache.org
> > > > 
> > > 
> > > 
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> lucene-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Search - Faster. Easier. Bingo.
> > http://search.yahoo.com
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> lucene-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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


Mime
View raw message