Re: How do I delete?

2005-02-02 Thread Jim Lynch
OK, the reference field was not parsed.  See:
 }else if(key.equals(reference) ) {
   reference = value;
   Field fReference = new Field(reference,value,true,true,false);
   doc.add(fReference);
On another examination of my program, the delete does seem to be 
working.  At least the delete returns a value of 1 saying it deleted one 
record.  However the search still keeps finding the old record.  I am 
doing an optimize after each index batch. 

Unfortuately the old record is still there even after I delete it.  So I 
deleted it and replaced it with the date in a different format to see if 
it was really replaced.  The date field indicates I've still got the old 
data in there for some reason.  Is data cached somewhere?

Jim.
Chris Hostetter wrote:
: anywhere.  I checked the count coming back from the delete operation and
: it is zero.  I even tried to delete another unique term with similar
: results.
First off, are you absolutely certain you are closing the reader?  it's
not in the code you listed.
Second, I'd bet $1 that when your documents were indexed, your reference
field was analyzed and parsed into multiple terms.  Did you try searching
for the Term you're trying to delete by?
(I hear luke is a pretty handy tool for checking exactly which Terms are
in your index)
: Here is the delete and associated code:
: 
:   reader = IndexReader.open(database);
: 
:   Term t = new Term(reference,reference);
:   try {
: reader.delete(t);
:   } catch (Exception e) {
: System.out.println(Delete exception;+e);
:   }
-Hoss
-
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]


How do I delete?

2005-02-01 Thread Jim Lynch
I've been merrily cooking along, thinking I was replacing documents when 
I haven't.  My logic is to go through a batch of documents, get a field 
called reference which is unique build a term from it and delete it 
via the reader.delete() method.  Then I close the reader and open a 
writer and reprocess the batch indexing all. 

Here is the delete and associated code:
 reader = IndexReader.open(database);
 Term t = new Term(reference,reference);
 try {
   reader.delete(t);
 } catch (Exception e) {
   System.out.println(Delete exception;+e);
 }
except it isn't working.  I tried to do a commt and a doCommit, but 
those are both protected.  I do a reader.close() after processing the 
batch the first time. 

What am I missing?  I don't get an exception.  Reference is definitely a 
valid field, 'cause I print out the value at search time and compare to 
the doc and they are identical.

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


Re: How do I delete?

2005-02-01 Thread Joseph Ottinger
I've had success with deletion by running IndexReader.delete(int), then
getting an IndexWriter and optimizing the directory. I don't know if
that's the right way to do it or not.

On Tue, 1 Feb 2005, Jim Lynch wrote:

 I've been merrily cooking along, thinking I was replacing documents when
 I haven't.  My logic is to go through a batch of documents, get a field
 called reference which is unique build a term from it and delete it
 via the reader.delete() method.  Then I close the reader and open a
 writer and reprocess the batch indexing all.

 Here is the delete and associated code:

   reader = IndexReader.open(database);

   Term t = new Term(reference,reference);
   try {
 reader.delete(t);
   } catch (Exception e) {
 System.out.println(Delete exception;+e);
   }

 except it isn't working.  I tried to do a commt and a doCommit, but
 those are both protected.  I do a reader.close() after processing the
 batch the first time.

 What am I missing?  I don't get an exception.  Reference is definitely a
 valid field, 'cause I print out the value at search time and compare to
 the doc and they are identical.

 Thanks,
 Jim.

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


---
Joseph B. Ottinger http://enigmastation.com
IT Consultant[EMAIL PROTECTED]


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



Re: How do I delete?

2005-02-01 Thread Jim Lynch
Thanks, I'd try that, but I don't think it will make any difference.  If 
I modify the code to not reindex the documents, no files in the index 
directory are touched, hence there is no record of the deletions 
anywhere.  I checked the count coming back from the delete operation and 
it is zero.  I even tried to delete another unique term with similar 
results.

How does one call the commit method anyway? Isn't it automatically called?
Jim.
Joseph Ottinger wrote:
I've had success with deletion by running IndexReader.delete(int), then
getting an IndexWriter and optimizing the directory. I don't know if
that's the right way to do it or not.
On Tue, 1 Feb 2005, Jim Lynch wrote:
 

I've been merrily cooking along, thinking I was replacing documents when
I haven't.  My logic is to go through a batch of documents, get a field
called reference which is unique build a term from it and delete it
via the reader.delete() method.  Then I close the reader and open a
writer and reprocess the batch indexing all.
Here is the delete and associated code:
 reader = IndexReader.open(database);
 Term t = new Term(reference,reference);
 try {
   reader.delete(t);
 } catch (Exception e) {
   System.out.println(Delete exception;+e);
 }
except it isn't working.  I tried to do a commt and a doCommit, but
those are both protected.  I do a reader.close() after processing the
batch the first time.
What am I missing?  I don't get an exception.  Reference is definitely a
valid field, 'cause I print out the value at search time and compare to
the doc and they are identical.
Thanks,
Jim.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   

---
Joseph B. Ottinger http://enigmastation.com
IT Consultant[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]


Re: How do I delete?

2005-02-01 Thread Joseph Ottinger
Well, in LuceneRAR, the delete by id code does exactly what I said: gets
the indexreader, deletes the doc id, then it opens a writer and optimizes.
Nothing else.

On Tue, 1 Feb 2005, Jim Lynch wrote:

 Thanks, I'd try that, but I don't think it will make any difference.  If
 I modify the code to not reindex the documents, no files in the index
 directory are touched, hence there is no record of the deletions
 anywhere.  I checked the count coming back from the delete operation and
 it is zero.  I even tried to delete another unique term with similar
 results.

 How does one call the commit method anyway? Isn't it automatically called?

 Jim.

 Joseph Ottinger wrote:

 I've had success with deletion by running IndexReader.delete(int), then
 getting an IndexWriter and optimizing the directory. I don't know if
 that's the right way to do it or not.
 
 On Tue, 1 Feb 2005, Jim Lynch wrote:
 
 
 
 I've been merrily cooking along, thinking I was replacing documents when
 I haven't.  My logic is to go through a batch of documents, get a field
 called reference which is unique build a term from it and delete it
 via the reader.delete() method.  Then I close the reader and open a
 writer and reprocess the batch indexing all.
 
 Here is the delete and associated code:
 
   reader = IndexReader.open(database);
 
   Term t = new Term(reference,reference);
   try {
 reader.delete(t);
   } catch (Exception e) {
 System.out.println(Delete exception;+e);
   }
 
 except it isn't working.  I tried to do a commt and a doCommit, but
 those are both protected.  I do a reader.close() after processing the
 batch the first time.
 
 What am I missing?  I don't get an exception.  Reference is definitely a
 valid field, 'cause I print out the value at search time and compare to
 the doc and they are identical.
 
 Thanks,
 Jim.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 ---
 Joseph B. Ottinger http://enigmastation.com
 IT Consultant[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]


---
Joseph B. Ottinger http://enigmastation.com
IT Consultant[EMAIL PROTECTED]


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



Re: How do I delete?

2005-02-01 Thread Chris Hostetter

: anywhere.  I checked the count coming back from the delete operation and
: it is zero.  I even tried to delete another unique term with similar
: results.

First off, are you absolutely certain you are closing the reader?  it's
not in the code you listed.

Second, I'd bet $1 that when your documents were indexed, your reference
field was analyzed and parsed into multiple terms.  Did you try searching
for the Term you're trying to delete by?

(I hear luke is a pretty handy tool for checking exactly which Terms are
in your index)

: Here is the delete and associated code:
: 
:   reader = IndexReader.open(database);
: 
:   Term t = new Term(reference,reference);
:   try {
: reader.delete(t);
:   } catch (Exception e) {
: System.out.println(Delete exception;+e);
:   }


-Hoss


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