You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by "Kainth, Sachin" <Sa...@atkinsglobal.com> on 2007/02/23 17:40:13 UTC
Index modification
Hi all,
It seems that DotLucene's IndexWriter class does not have the index
modification features (such as deletion of documents from the index)
that the Java version's IndexWriter class does. For this reason I am
using the IndexModifier class. I have deleted 1 document from an index
and the output indicates that 1 document does indeed get deleted.
However, running the program again reveals that the document deleted has
appeared again in the index. This despite the fact that I close the
IndexModifier after the deletion. Does anyone know what I'm missing?
Here is my code:
Analyzer analyzer = new PorterAnalyzer();
IndexModifier indexModifier = new IndexModifier("D:\\Index",
analyzer, false);
Console.WriteLine(indexModifier.DocCount() + " docs in
index");
//indexModifier.Delete(1);
indexModifier.Delete(new Term("artist", "hot"));
Console.WriteLine("Deleted a document");
Console.WriteLine(indexModifier.DocCount() + " docs in
index");
indexModifier.Close();
This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.
The ultimate parent company of the Atkins Group is WS Atkins plc. Registered in England No. 1885586. Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18 5BW.
Consider the environment. Please don't print this e-mail unless you really need to.
RE: Index modification
Posted by "Martin, Chris" <ch...@mykb.com>.
I've had good luck using the DeleteDocuments() method of IndexReader.
-----Original Message-----
From: Kainth, Sachin [mailto:Sachin.Kainth@atkinsglobal.com]
Sent: Friday, February 23, 2007 9:40 AM
To: lucene-net-user@incubator.apache.org
Subject: Index modification
Hi all,
It seems that DotLucene's IndexWriter class does not have the index
modification features (such as deletion of documents from the index)
that the Java version's IndexWriter class does. For this reason I am
using the IndexModifier class. I have deleted 1 document from an index
and the output indicates that 1 document does indeed get deleted.
However, running the program again reveals that the document deleted has
appeared again in the index. This despite the fact that I close the
IndexModifier after the deletion. Does anyone know what I'm missing?
Here is my code:
Analyzer analyzer = new PorterAnalyzer();
IndexModifier indexModifier = new IndexModifier("D:\\Index",
analyzer, false);
Console.WriteLine(indexModifier.DocCount() + " docs in
index");
//indexModifier.Delete(1);
indexModifier.Delete(new Term("artist", "hot"));
Console.WriteLine("Deleted a document");
Console.WriteLine(indexModifier.DocCount() + " docs in
index");
indexModifier.Close();
This email and any attached files are confidential and copyright
protected. If you are not the addressee, any dissemination of this
communication is strictly prohibited. Unless otherwise expressly agreed
in writing, nothing stated in this communication shall be legally
binding.
The ultimate parent company of the Atkins Group is WS Atkins plc.
Registered in England No. 1885586. Registered Office Woodcote Grove,
Ashley Road, Epsom, Surrey KT18 5BW.
Consider the environment. Please don't print this e-mail unless you
really need to.
RE: Index modification
Posted by George Aroush <ge...@aroush.net>.
Hi Sachin,
You are comparing two different versions. The latest version of Lucene.Net
is 2.0 and it got the same APIs as found in Java Lucene 2.0 -- this is the
case for all released version of Lucene.Net.
I am in the process of staring the port of Lucene 2.1, then you will see the
method which you are referring to.
Btw, the correct name of Lucene port is "Lucene.Net", not "DotLucene".
Regards,
-- George Aroush
-----Original Message-----
From: Kainth, Sachin [mailto:Sachin.Kainth@atkinsglobal.com]
Sent: Friday, February 23, 2007 11:40 AM
To: lucene-net-user@incubator.apache.org
Subject: Index modification
Hi all,
It seems that DotLucene's IndexWriter class does not have the index
modification features (such as deletion of documents from the index) that
the Java version's IndexWriter class does. For this reason I am using the
IndexModifier class. I have deleted 1 document from an index and the output
indicates that 1 document does indeed get deleted.
However, running the program again reveals that the document deleted has
appeared again in the index. This despite the fact that I close the
IndexModifier after the deletion. Does anyone know what I'm missing?
Here is my code:
Analyzer analyzer = new PorterAnalyzer();
IndexModifier indexModifier = new IndexModifier("D:\\Index",
analyzer, false);
Console.WriteLine(indexModifier.DocCount() + " docs in index");
//indexModifier.Delete(1);
indexModifier.Delete(new Term("artist", "hot"));
Console.WriteLine("Deleted a document");
Console.WriteLine(indexModifier.DocCount() + " docs in index");
indexModifier.Close();
This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.
The ultimate parent company of the Atkins Group is WS Atkins plc.
Registered in England No. 1885586. Registered Office Woodcote Grove, Ashley
Road, Epsom, Surrey KT18 5BW.
Consider the environment. Please don't print this e-mail unless you really
need to.