lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edward W. Rouse" <ero...@comsquared.com>
Subject RE: IndexWriter.deleteDocuments(Term) only deletes one at a time
Date Thu, 17 May 2012 15:33:44 GMT
Never mind, turns out the Term isn't matching for some as yet unknown reason
and the feedback in my logs was misleading. Sorry for the noise.

> -----Original Message-----
> From: Edward W. Rouse [mailto:erouse@comsquared.com]
> Sent: Thursday, May 17, 2012 10:19 AM
> To: java-user@lucene.apache.org
> Subject: IndexWriter.deleteDocuments(Term) only deletes one at a time
> 
> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message