Hello!

I'm using Apache Lucene 5.0.0 and I have the problem that after some time/some "transactions" the index seems to become corrupt and I get the following exception:

|org.apache.lucene.index.IndexFormatTooOldException:  Format  version is not 
supported(resourceBufferedChecksumIndexInput(NIOFSIndexInput(path="/opt/xyz/index/1/index/segments_5b"))):
  -911482135  (needs to be between1071082519  and1071082519).  This  version ofLucene  
only supports indexes created with release4.0  and later.
    at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:288)  
~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]
    at 
org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:53)
  ~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]
    at 
org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:50)
  ~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]
    at 
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:642)
  ~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]
    at 
org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)
  ~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]
    at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63)  
~[lucene-core-5.0.0.jar:5.0.0  1659987  -  anshumgupta-  2015-02-15  12:20:03]|

Here the pieces of code that I use to perform the search and indexing operations:

*Search*:

|Directory  directory=  getIndexDirectory();
IndexReader  indexReader=  DirectoryReader.open(directory);
IndexSearcher  is=  new  IndexSearcher(indexReader);
...


private  Directory  getDirectory()  throws  Exception  {
    final  File  dir=  new  File(...);
    return  FSDirectory.open(dir.toPath());
}|

And for *indexing* I get the index writer with the following method:

|private  IndexWriter  getIndexWriter(final  Directory  directory)  throws  
Exception  {
    return  new  IndexWriter(directory,  getIndexWriterConfig());
}

private  IndexWriterConfig  getIndexWriterConfig()  {
    final  IndexWriterConfig  config=  new  IndexWriterConfig(new  
StandardAnalyzer());
    config.setOpenMode(OpenMode.CREATE_OR_APPEND);
    return  config;
}|

When I create the index from scratch and perform a re-indexing of all documents the search works fine. I can add new documents to the index and/or remove existing ones and the search continues to work. However after a while (I cannot understand the "trigger" of the problem) the search stops to work and I get this IndexFormatTooOldException.

Do you have an idea what could be the cause of this problem?

Thanks for your help!

Patrick

Reply via email to