IndexWriter will try to delete obsolete files when it is closed.
If the files cannot be deleted immediately for whatever reason (usually
because some IndexReaderIndexSearcher has them open)
it will list the files to deleted in the file "deletable".

On the next update of the index, the other IndexReader(s) should have
closed and reopened by then and the deletes will succeed.

A mechanism to check if there are deletable files present would be handy
so IndexWriter.open and IndexWriter.close can be called even when there
are no other updates to be done.
Or even a method cleanupIndex() or something that retries to delete
deletable files.

The problem is even more present if you recreate an index by passing
true as last parameter while creating the IndexWriter.
Then all the old segments are left in the Directory, but they aren't
even marked as deletable...

I may attach a patch to JIRA one of these days, no promises though...

Luc


-----Original Message-----
From: Mordo, Aviran (EXP N-NANNATEK) [mailto:[EMAIL PROTECTED] 
Sent: donderdag 22 december 2005 22:38
To: java-user@lucene.apache.org
Subject: RE: Basic lucene usage

I'm sorry if I wasn't clear. You can not delete the files themselves,
you delete the documents within the index

-----Original Message-----
From: John Powers [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 22, 2005 4:11 PM
To: java-user@lucene.apache.org
Subject: RE: Basic lucene usage

I am unable to delete those files while an indexsearcher has them open.
Are you sure that's possible (question/response #1)?

I sorta have to stick to a single directory.   I guess I'll have to work
around that.

-----Original Message-----
From: Mordo, Aviran (EXP N-NANNATEK) [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 22, 2005 3:09 PM
To: java-user@lucene.apache.org
Subject: RE: Basic lucene usage

 

-----Original Message-----
From: John Powers [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 22, 2005 3:40 PM
To: java-user@lucene.apache.org
Subject: RE: Basic lucene usage

>If you open an indexsearcher and keep a single indexsearcher open for
all sessions to use, then can an indexwriter delete the files >and
create
>the new files as needed?    

Yes, but the changes will not show up in the search until you get a new
instance of IndexSearcher.

>To start an indexsearcher, you pass in the directory.  Doesn't that tie
the searcher to the files?  So an indexwriter couldn't come >along and
reindex (delete and recreate) the directory while the searcher has a
hold of those files..correct?

If you want to recreate the index, you'll need to do that on a different
folder and then get a new IndexSearcher Instance that points to the new
folder, once you are done.

>So if I have a single indexsearcher, if I want to recreate the index, I
would have to stop the indexsearcher, go through creating the index,
then get a new fsdirectory for a new indexsearcher, correct?

Yes, but see previous answer for better usability.

HTH

Aviran
http://www.aviransplace.com

-----Original Message-----
From: Mordo, Aviran (EXP N-NANNATEK) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 06, 2005 12:19 PM
To: java-user@lucene.apache.org
Subject: RE: Basic lucene usage

Lucene is thread safe, it is recommended that you only have one
IndexSearcher instance. No problems with multiple searches on the same
IndexSearcher.

You can index while searching, as soon as you want the new entries to be
found by the IndexSearcher, just get a new instance of IndexSearcher

Aviran
http://www.aviransplace.com

-----Original Message-----
From: John Powers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 06, 2005 1:13 PM
To: java-user@lucene.apache.org
Subject: Basic lucene usage

Am I correct in assuming that I can use lucene by itself as a search
engine
in a website?   If each user session is looking at the fsdirectory and
searching on it, is that ok?   Or do I need to put in a queue or pool
that
handles searching it; only allowing the one thing application-wide to
actually get to the fsdirectory?    Can 100 people look at the
fsdirectory
at the same time?  Or do you generally put in a single entry point that
queues requests for a search from those 100 people?

And I guess I have the same question about writing/indexing.  Locks are
creating as apart of the indexing process, correct?  So you'd definitly
not want multiple people doing that at the same time?  What is the best
practice
to stop that?   

Are locks created as apart of searching?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to