How can I merge .cfx and .cfs into a single cfs file?

2010-05-04 Thread
Hi all, I have an index task which will index thousands of records with lucene 3.0.1. My confusion is lucene will always create a .cfx and a .cfs file in the file system, sometimes more, while I thought it should create a single .cfs file if I optimize the index data. Is it by design? If yes, i

Re: How can I merge .cfx and .cfs into a single cfs file?

2010-05-05 Thread
t with the extension .cfx. In addition to Compound File .cfs An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles. Uwe -Ursprüngliche Nachricht- Von: 张志田 [mailto:zhitian.zh...@dianping.com] Gesendet: Mittwoc

Re: How can I merge .cfx and .cfs into a single cfs file?

2010-05-05 Thread
ns a merge from the findMergesForOptimize for this case (the default MergePolicy returns null since it thinks this case is already optimized). Or... if you index with two separate IndexWriter sessions, and then call optimize, that should also merge down to one file. Mike 2010/5/5 张志田 : > Uwe, t

Can not delete index file after close the IndexSearcher

2011-01-12 Thread
Dear Luceners, I'm using lucene-3.0.2 in our app. There is some testing code for switching index, however, when my code run a couple of times, I found the index file was locked, I can not delete the old index files. The code looks like: public class SearchTest { private static final int MA

Re: Can not delete index file after close the IndexSearcher

2011-01-12 Thread
'Q') you don't close the > current searcher. Could that be it? > > Also you are calling FSDir.open each time but should only do it once > (though this should be "harmless"). > > Mike > > On Wed, Jan 12, 2011 at 5:39 AM, 张志田 wrote: > > Dear Luc

Re: Can not delete index file after close the IndexSearcher

2011-01-12 Thread
gt; exception? > > Also, can you whittle down your example even more? EG if calling > this method twice causes the problem, make a method that calls it > twice and hits the exception and then start simplifying from there... > > Mike > > 2011/1/12 张志田 : > > Mike, thanks for

Re: Can not delete index file after close the IndexSearcher

2011-01-12 Thread
ssing the directory needs to be closed before opening a new one. > > dir.close(); > dir = FSDirectory.open(new File(getIndexPath())); > > why not to open two IndexSearcher objects in an array of two instead of > swapping them back and forth? > it would be a lot easier. > > yu

Re: Can not delete index file after close the IndexSearcher

2011-01-13 Thread
es of > only opening new searcher if need to. > > > -- > Ian. > > 2011/1/13 张志田 : > > Hi Yuhan, > > > > dir.close() can not solve the problem. > > > > The reason I have to close the old searcher is my program will replace > the > > old ind

Re: Can not delete index file after close the IndexSearcher

2011-01-13 Thread
IndexSearcher(dir); line with > > if (needToOpenNewSearcher()) { > ... > } > > where the logic in needToOpenNewSearcher() is for you to write. > > > -- > Ian. > > > 2011/1/13 张志田 : > > Ian, thanks for your response. Your suggestion worked for me. &g