Below is the relevant portion of the code were this occurs. I have a test
index with 100 Documents that all have 1 Term that is the same across all
Documents. When I run this code using that Term and the common value, it
only deletes one document. Every time I rerun the code with the same values
it deletes another one. Am I doing something wrong? I can't figure out why
it doesn't delete them all with one call to this code.
this.getWriter(indexName).deleteDocuments(this.createIdTerm(id));
this.getWriter(indexName).commit();
private IndexWriter getWriter(String index) throws IOException
{
if(writers.containsKey(index))
{
return writers.get(index);
}
else
{
return addWriter(index);
}
}
private Term createIdTerm(String id)
{
return new Term(Constants.DEFAULT_ID_FIELD, id);
}
public IndexWriterConfig getWriterConfig()
{
if(writerConfig == null)
{
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
writerConfig = new IndexWriterConfig(Version.LUCENE_36, analyzer);
}
return writerConfig;
}
private IndexWriter addWriter(String index) throws IOException
{
if(writers.containsKey(index))
{
return writers.get(index);
}
else
{
File f = new File(Constants.ROOT_DIR + index);
FSDirectory d = FSDirectory.open(f);
IndexWriter writer = new IndexWriter(d, getWriterConfig());
writers.put(index, writer);
return writer;
}
}
Edward W. Rouse
Comsquared System, Inc.
770-734-5301
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]