You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ben Hood <0x...@gmail.com> on 2011/06/06 11:58:31 UTC

IndexNotFoundException

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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: IndexNotFoundException

Posted by Ben Hood <0x...@gmail.com>.
Ian,

Thanks a lot for the heads up. I didn't even know those detailed
release notes existed - I just looked on the main release page and
searched a bit through JIRA.

Cheers,

Ben

On Mon, Jun 6, 2011 at 2:57 PM, Ian Lea <ia...@gmail.com> wrote:
> 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 <0x...@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-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
>
>

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


Re: IndexNotFoundException

Posted by Ian Lea <ia...@gmail.com>.
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 <0x...@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-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


Re: IndexNotFoundException

Posted by Ben Hood <0x...@gmail.com>.
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 <0x...@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org