Hello Mike,

Now I have working code !!-)
For instant deletion I just changed my code so, that in most cases
(except one) each index writer/reader is newly created in the begin of
method(s) and .close(), =null in the end. Maybe =null is not really
necessary, but I'll feel more comfortable with it.
That's all !
Hope you'll success after review your code !
For simplicity I've created 4 methods:

private IndexWriter raiseIWriter( boolean createNew ) throws IOException {
    return new IndexWriter( whereIndex, indAna, createNew );
}
private void dropIWriter( IndexWriter iw ) throws IOException {
    iw.close();
    iw = null;
}

and similar for IndexReader, and than mostly NO used any reader/writer
except what I get with this methods:

// example of deleter:
private void idxDeleteDoc( String fldName, String fldVal ) throws IOException {
    infoln( "idx_del [" + fldName + ", " + fldVal + "]" );
    IndexReader ir = raiseIReader();
    ir.delete( new Term( fldName, fldVal ) );
    dropIReader( ir );
}

Maybe it's important that no any spare reader/writer opened at the time of
document deletion with IndexReader.
Maybe similar sentence is present in FAQ :-) I dunno :-)

Bye !

MB> Thanks for your response.
MB> Unfortunally, it was not really the answer I hoped ! :-)

MB> But I still look around and I won't miss to let you know if I find something
MB> positive.

MB> Tanks again.

MB> Mike

MB> ----- Original Message -----
MB> From: "Serge A. Redchuk" <[EMAIL PROTECTED]>
MB> To: <[EMAIL PROTECTED]>
MB> Sent: Friday, December 14, 2001 4:42 PM
MB> Subject: Re: delete/update


>> Hello Mike,
>>
>> Friday, December 14, 2001, 3:51:15 PM, you wrote:
>>
>>
>> MB> Hi.
>>
>> MB> I send you this mail because I saw a post you made on Lucene Mailing
MB> List about deleting an indexed document.
>> MB> I was wondering if you solved your problem : I'm unable to remove a
MB> document form an index.
>>
>> Oh! Unfortunatelly now I see that deletion is not ideal... :-(
>> But !!!
>> I found that It's working with "delay" ;-)
>> I was confused but I'll explain.
>> Using next steps: 1 - what my program does, 2 - what is the result in what
MB> case.
>>
>> 1 - what my program does
>> in general my program try to do the next:
>>
>> 1. reindex Lucene index if something changed
>>    (file modified, dleted, new appeared), all unmodified remains untouched
>> 2. do search
>> 3. show result
>>
>> 2 - what is the result in what case
>> I force my program to delete one file from index, and then to search
>> for words that was only in deleted file.
>> Still unsutisfied - the unexpected result that the words found ...
>>
>> So, I start my program again and now it does nothing with index !
>> And search fails ! :-))))
>>
>> I can't figure out whay that. Whay deletion comes true not instantly.
>>
>> I've really _CLOSED_ and even assigned null(s) to all index readers and
>> writers !!
>>
>> So, I can't answer you completely, but for now I satisfied by this
>> partial result.
>>
>> MB> If you solved it, do you have any hint for me ?
>> MB> If you don't solved it, do you remember if methode 'delete' of
MB> IndexReader wich return the number of really deleted document was returning
MB> 1 ? (for me, it return 0, so I don't have the problem to
>> MB> refresh the index, but to remove a document from the index ...).
>>
>>
>>
>> --
>> Best regards,
>>  Serge                            mailto:[EMAIL PROTECTED]
>>
>>
>> --
>> To unsubscribe, e-mail:
MB> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
MB> <mailto:[EMAIL PROTECTED]>
>>
>>


MB> --
MB> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
MB> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




-- 
Best regards,
 Serge                            mailto:[EMAIL PROTECTED]


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

Reply via email to