My version is 4.10.0 which is later than 4.5, but I didn't find the fix like https://issues.apache.org/jira/secure/attachment/12593180/LUCENE-5116.patch in indexwriter, neither in 4.10.4. Not sure which version has fixed it.
public void addIndexes(IndexReader... readers) throws IOException { ensureOpen(); int numDocs = 0; try { if (infoStream.isEnabled("IW")) { infoStream.message("IW", "flush at addIndexes(IndexReader...)"); } flush(false, true); String mergedName = newSegmentName(); final List<AtomicReader> mergeReaders = new ArrayList<>(); for (IndexReader indexReader : readers) { numDocs += indexReader.numDocs(); for (AtomicReaderContext ctx : indexReader.leaves()) { mergeReaders.add(ctx.reader()); } } // Make sure adding the new documents to this index won't // exceed the limit: reserveDocs(numDocs); final IOContext context = new IOContext(new MergeInfo(numDocs, -1, true, -1)); 2017-03-09 22:44 GMT+08:00 Steve Rowe <sar...@gmail.com>: > Maybe <https://issues.apache.org/jira/browse/LUCENE-5116> (though it was > committed in Lucene 4.5)? Robert Muir pointed to this issue as fixing < > https://issues.apache.org/jira/browse/SOLR-5144>, which contains a > similar stack track to yours. > > -- > Steve > www.lucidworks.com > > > On Mar 9, 2017, at 6:02 AM, Michael McCandless < > luc...@mikemccandless.com> wrote: > > > > This seems likely to be a Lucene bug, and it seems vaguely familiar. I > > tried to find the issue / commit that may have fixed it, but so far > failed. > > > > But 4.10.0 is truly ancient; you should at least try upgrading to 4.10.4? > > > > Mike McCandless > > > > http://blog.mikemccandless.com > > > > On Wed, Mar 8, 2017 at 6:15 AM, Yonghui Zhao <zhaoyong...@gmail.com> > wrote: > > > >> Seems it is related to an empty segment, all docs in this segment are > >> deleted before commit. > >> Any one can confirm it? Maybe I need upgrade my lucene version. > >> > >> > >> 2017-03-03 10:19 GMT+08:00 Yonghui Zhao <zhaoyong...@gmail.com>: > >> > >>> Hi all, > >>> > >>> Anyone see this exception before? Is it a lucene bug or something wrong > >>> in my code? > >>> > >>> > >>> Exception in thread "Thread-14" java.lang.IllegalArgumentException: > >>> maxValue must be non-negative (got: -1) > >>> at org.apache.lucene.util.packed.PackedInts.bitsRequired( > >>> PackedInts.java:1141) > >>> at org.apache.lucene.codecs.lucene41.ForUtil.bitsRequired( > >>> ForUtil.java:253) > >>> at org.apache.lucene.codecs.lucene41.ForUtil.writeBlock( > >>> ForUtil.java:174) > >>> at org.apache.lucene.codecs.lucene41.Lucene41PostingsWriter. > >>> addPosition(Lucene41PostingsWriter.java:377) > >>> at org.apache.lucene.index.FreqProxTermsWriterPerField.flush( > >>> FreqProxTermsWriterPerField.java:486) > >>> at org.apache.lucene.index.FreqProxTermsWriter.flush( > >>> FreqProxTermsWriter.java:80) > >>> at org.apache.lucene.index.DefaultIndexingChain.flush( > >>> DefaultIndexingChain.java:114) > >>> at org.apache.lucene.index.DocumentsWriterPerThread.flush( > >>> DocumentsWriterPerThread.java:441) > >>> at org.apache.lucene.index.DocumentsWriter.doFlush( > >>> DocumentsWriter.java:510) > >>> at org.apache.lucene.index.DocumentsWriter.flushAllThreads( > >>> DocumentsWriter.java:621) > >>> at org.apache.lucene.index.IndexWriter.getReader( > >>> IndexWriter.java:414) > >>> at org.apache.lucene.index.StandardDirectoryReader. > >>> doOpenFromWriter(StandardDirectoryReader.java:292) > >>> at org.apache.lucene.index.StandardDirectoryReader. > >>> doOpenIfChanged(StandardDirectoryReader.java:267) > >>> at org.apache.lucene.index.StandardDirectoryReader. > >>> doOpenIfChanged(StandardDirectoryReader.java:257) > >>> at org.apache.lucene.index.DirectoryReader.openIfChanged( > >>> DirectoryReader.java:171) > >>> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >