lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ioannis Cherouvim ...@eworx.gr>
Subject Re: cannot delete cfs files on windows
Date Thu, 13 Mar 2008 13:47:42 GMT
Hello

I index once every 24h. If a single search takes place between those 
24hours, the next indexing will generate a new cfs file, because the old 
one cannot be deleted.

Yes, I've read in the API that it's best not to open and close an 
IndexReader for every search, but right now I'm not concerned with 
performance (unless there is another problem with opening and closing). 
In any case, how should I deal with it? Will a singleton holding the 
IndexReader do the job? This is a web application.

Note that I'm not concerned about the actual files not being able to be 
deleted, nor the extra HD space that these occupy. I'm afraid that all 
these "locked" cfs files hold file handles which is not good for the O/S 
(?).

Right now I can only delete those cfs files when I stop the tomcat 
instance which runs my web application.

thanks,
Ioannis

Grant Ingersoll wrote:
> Not sure why you can't close, but it's a bit suspicious that you are 
> opening the IndexReader every time you do a search.  Can you explain a 
> little more about your process?  When are you indexing, how often, etc.?
>
> -Grant
>
> On Mar 12, 2008, at 11:50 AM, Ioannis Cherouvim wrote:
>
>> Hello
>>
>> I can index many times and delete the index files (manually). But if 
>> I search once, then the cfs file is locked and cannot be deleted. 
>> Subsequent indexings create new cfs files. Even if I undeploy the 
>> tomcat web application which holds the search code, the cfs file 
>> cannot be deleted.
>>
>>
>> O/S:
>> Windows XP
>>
>>
>> Code to index:
>> IndexWriter writer = new IndexWriter(
>>   PATH,
>>   new StandardAnalyzer(),
>>   true);
>>
>> writer.addDocument(doc1);
>> writer.addDocument(doc2);
>> writer.addDocument(doc3);
>>
>> writer.optimize();
>> writer.close();
>>
>>
>> Code to search:
>> Searcher searcher = null;
>> IndexReader indexReader = null;
>> try {
>>   indexReader = IndexReader.open(PATH);
>>   searcher = new IndexSearcher(indexReader);
>>   Hits hits = searcher.search(query);
>>   ...
>> } finally {
>>   searcher.close();
>>   indexReader.close();
>> }
>>
>>
>>
>> Am I doing something wrong?
>>
>> thanks,
>> Ioannis
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>
> --------------------------
> Grant Ingersoll
> http://www.lucenebootcamp.com
> Next Training: April 7, 2008 at ApacheCon Europe in Amsterdam
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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