Mailing List Archive

delete/update
Hello lucene-user,

You can laugh, but it's not clear to me how to update/remove Field
from Document (can only add) or even update/remove Document from
Index.
But I saw this magic words (update/remove) in this conference.
And did NOT - in Lucene online documentation !!!

Can anybody help me ??? I'll be very appreciate ...

--
Best regards,
Serge mailto:bitl@mail.ru


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: delete/update [ In reply to ]
Hi Serge,

You can't remove a field from a Document. If you compare an Index in Lucene to a
table in a relational database, a Document is a row and a Field is a column.
You can always delete a row but you cannot remove a column (for a single row).
However, if you can directly update a row in a database, you can't update a
Document. Instead you have to delete that Document, create a new one with new
values and add it to the index.

Note that I'm new to Lucene and the above infos may not be 100% accurate
(hopefully not 100% wrong !!).

JCG




Hello lucene-user,

You can laugh, but it's not clear to me how to update/remove Field
from Document (can only add) or even update/remove Document from
Index.
But I saw this magic words (update/remove) in this conference.
And did NOT - in Lucene online documentation !!!

Can anybody help me ??? I'll be very appreciate ...






--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: delete/update [ In reply to ]
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 List about deleting an indexed document.
MB> I was wondering if you solved your problem : I'm unable to remove a 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 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 IndexReader wich return the number of really deleted document was returning 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:bitl@mail.ru


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re: delete/update [ In reply to ]
Serge,

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

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

Tanks again.

Mike

----- Original Message -----
From: "Serge A. Redchuk" <bitl@mail.ru>
To: <lucene-user@jakarta.apache.org>
Sent: Friday, December 14, 2001 4:42 PM
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
List about deleting an indexed document.
> MB> I was wondering if you solved your problem : I'm unable to remove a
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
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
IndexReader wich return the number of really deleted document was returning
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:bitl@mail.ru
>
>
> --
> To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:lucene-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>
Re[2]: delete/update [ In reply to ]
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" <bitl@mail.ru>
MB> To: <lucene-user@jakarta.apache.org>
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:bitl@mail.ru
>>
>>
>> --
>> To unsubscribe, e-mail:
MB> <mailto:lucene-user-unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail:
MB> <mailto:lucene-user-help@jakarta.apache.org>
>>
>>


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




--
Best regards,
Serge mailto:bitl@mail.ru


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