For note, this code works with 3.0.3: 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.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())); IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(Version.LUCENE_30), IndexWriter.MaxFieldLength.UNLIMITED); IndexSearcher searcher = new IndexSearcher(dir, true); } } 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