In the release notes for 3.1.0 under Changes in backwards compatibility policy it says
LUCENE-2386: IndexWriter no longer performs an empty commit upon new index creation. Previously, if you passed an empty Directory and set OpenMode to CREATE*, IndexWriter would make a first empty commit. If you need that behavior you can call writer.commit()/close() immediately after you create it. https://issues.apache.org/jira/browse/LUCENE-2386 -- Ian. On Mon, Jun 6, 2011 at 10:58 AM, Ben Hood <0x6e6...@gmail.com> wrote: > Hi, > > I'm trying to upgrade from 3.0.2 to 3.2.0 and am running into the > following issue when trying to boot an IndexSearcher: > > Exception in thread "main" > org.apache.lucene.index.IndexNotFoundException: no segments* file > found in > org.apache.lucene.store.NIOFSDirectory@/tmp/804f7160-9023-11e0-9123-0022192d0d03 > lockFactory=org.apache.lucene.store.NativeFSLockFactory@7a6d084b: > files: [write.lock] > at > org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:711) > at > org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:75) > at org.apache.lucene.index.IndexReader.open(IndexReader.java:428) > at org.apache.lucene.index.IndexReader.open(IndexReader.java:288) > at > org.apache.lucene.search.IndexSearcher.<init>(IndexSearcher.java:107) > at > net.lshift.diffa.kernel.util.IndexWriterTest.main(IndexWriterTest.java:21) > > I've created a stripped down test case that reproduces the issue (see below). > > Is there something I'm doing wrong here? I would have assumed that > after the IndexWriter constructor has returned, then the necessary > index segments would in the directory on disk, or is this operation > asynchronous? > > Thanks for any help, > > Cheers, > > Ben > > ------ > > package net.lshift.diffa.kernel.util; > > import com.eaio.uuid.UUID; > import org.apache.lucene.analysis.standard.StandardAnalyzer; > import org.apache.lucene.index.IndexWriter; > import org.apache.lucene.index.IndexWriterConfig; > import org.apache.lucene.search.IndexSearcher; > import org.apache.lucene.store.FSDirectory; > import org.apache.lucene.util.Version; > > import java.io.File; > > public class IndexWriterTest { > > public static void main(String[] args) throws Exception { > FSDirectory dir = FSDirectory.open(new File("/tmp/" + new > UUID().toString())); > IndexWriterConfig config = new > IndexWriterConfig(Version.LUCENE_32, new > StandardAnalyzer(Version.LUCENE_32)); > config.setOpenMode(IndexWriterConfig.OpenMode.CREATE); > IndexWriter writer = new IndexWriter(dir, config); > IndexSearcher searcher = new IndexSearcher(dir, true); > } > > } > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org