I had the same issue with trying to delete by GUID. Lowercase worked
just fine :)

-----Original Message-----
From: Digy [mailto:[EMAIL PROTECTED] 
Sent: 14 May 2008 17:50
To: lucene-net-user@incubator.apache.org
Subject: RE: Can't delete documents

It must be a casing problem. See the code below.

                //INDEX
            IndexWriter wr = new IndexWriter("TempIndex", new
Lucene.Net.Analysis.Standard.StandardAnalyzer(), true);
            Document doc = new Document();
            doc.Add(new Field("field1", "12345678X", Field.Store.YES,
Field.Index.TOKENIZED));
            wr.AddDocument(doc);
            wr.Close();

            //DELETE (UPPERCASE)
            IndexSearcher src = new IndexSearcher("TempIndex");
            src.Reader.DeleteDocuments( new Term("field1","12345678X")
);
            src.Close();

            //NUM DOCS
            src = new IndexSearcher("TempIndex");
            Console.WriteLine(src.Reader.NumDocs().ToString() + "\n");
//
<-- 1
            src.Close();

            //DELETE (LOWERCASE)
            src = new IndexSearcher("TempIndex");
            src.Reader.DeleteDocuments( new Term("field1","12345678x")
);
            src.Close();

            //NUM DOCS
            src = new IndexSearcher("TempIndex");
            Console.WriteLine(src.Reader.NumDocs().ToString() + "\n");
//
<-- 0
            src.Close();

OUTPUT:
1
0

DIGY

-----Original Message-----
From: Gautam Lad [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 14, 2008 5:32 AM
To: lucene-net-user@incubator.apache.org
Subject: RE: Can't delete documents

Sorry I sent an email earlier about the casing which should have been in
response to this message.

Anywho, as I've said I didn't realize casing had an issue.

Any other suggestions?

-----Original Message-----
From: zoolette [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 13, 2008 5:32 PM
To: lucene-net-user@incubator.apache.org
Subject: Re: Can't delete documents

I think, because I had the same issue, that the isbn, considering the
analyzer you used, is indexed in lower case while you try to delete a
value
by specifying it in upper case.

Seb

2008/5/13 Gautam Lad <[EMAIL PROTECTED]>:

> Hi there
>
> I have indexed my documents using various keys, and one of the keys is
an
> ISBN.
>
> ISBNs can be all numeric or have an X at the end, (eg. 123456789X or
> 1234567890)
>
> Each of my documents is added to an index like so:
>  doc.Add(New Field(key.Name, key.Value, Field.Store.YES,
> Field.Index.TOKENIZED))
>  Here, key.Name = "isbn" and key.value = "123456789X"
>
> When I delete documents I use the following piece of code:
>
>    Public Sub DeleteSpecificKey()
>        Dim LReader As Index.IndexReader =
> Index.IndexReader.Open(Store.FSDirectory.GetDirectory(IndexDir,
False))
>        Dim iResult As Integer
>          iResult = LReader.DeleteDocuments("isbn", "123456789X"))
>          LReader.Close()
>    End Sub
>
> However, since there's an "X" in the key value, it doesn't delete it.
If
> the value was all numeric it works fine.
>  What am I missing here? Everything else works fine as far as
searching
> goes.
>  Thanks,
>
>



__________ Information from ESET NOD32 Antivirus, version of virus
signature
database 3097 (20080514) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com 
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated. If you 
have received it in error, please delete it from your system. Do not use, copy 
or disclose the information in any way nor act in reliance on it and notify the 
sender immediately.
 
Please note that the BBC monitors e-mails sent or received. Further 
communication will signify your consent to this

This e-mail has been sent by one of the following wholly-owned subsidiaries of 
the BBC:
 
BBC Worldwide, Registration Number: 1420028 England, Registered Address: 
Woodlands, 80 Wood Lane, London W12 0TT
BBC World, Registration Number: 04514407 England, Registered Address: 
Woodlands, 80 Wood Lane, London W12 0TT
BBC World Distribution Limited, Registration Number: 04514408, Registered 
Address: Woodlands, 80 Wood Lane, London W12 0TT

Reply via email to