Apache Lucene open-source search software
LUCENE-4055: merge trunk (1341011-1341932)
Robert Muir9cde5052a247
diff --cc lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.javaindex d7a83154e34,15f2ea5128c..73be17e9382--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.java@@@ -209,8 -208,8 +209,8 @@@ public final class Lucene40StoredFields}@Override- public void finish(int numDocs) throws IOException {+ public void finish(FieldInfos fis, int numDocs) throws IOException {- if (4+((long) numDocs)*8 != indexStream.getFilePointer())+ if (HEADER_LENGTH_IDX+((long) numDocs)*8 != indexStream.getFilePointer())// This is most likely a bug in Sun JRE 1.6.0_04/_05;// we detect that the bug has struck, here, and// throw an exception to prevent the corruption fromdiff --cc lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.javaindex f27f72be9f5,c0bee037207..8e73e5b613d--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsReader.java@@@ -708,7 -688,15 +688,7 @@@ public class Lucene40TermVectorsReadercloneTvf = (IndexInput) tvf.clone();}- return new Lucene40TermVectorsReader(fieldInfos, cloneTvx, cloneTvd, cloneTvf, size, numTotalDocs, format);+ return new Lucene40TermVectorsReader(fieldInfos, cloneTvx, cloneTvd, cloneTvf, size, numTotalDocs);}-- public static void files(SegmentInfo info, Set<String> files) throws IOException {- if (info.getHasVectors()) {- files.add(IndexFileNames.segmentFileName(info.name, "", VECTORS_INDEX_EXTENSION));- files.add(IndexFileNames.segmentFileName(info.name, "", VECTORS_FIELDS_EXTENSION));- files.add(IndexFileNames.segmentFileName(info.name, "", VECTORS_DOCUMENTS_EXTENSION));- }- }}diff --cc lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsWriter.javaindex d6db8add8db,a61c32170af..5cc2d1bfa2d--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40TermVectorsWriter.java@@@ -356,8 -361,8 +362,8 @@@ public final class Lucene40TermVectorsW}@Override- public void finish(int numDocs) throws IOException {+ public void finish(FieldInfos fis, int numDocs) throws IOException {- if (4+((long) numDocs)*16 != tvx.getFilePointer())+ if (HEADER_LENGTH_INDEX+((long) numDocs)*16 != tvx.getFilePointer())// This is most likely a bug in Sun JRE 1.6.0_04/_05;// we detect that the bug has struck, here, and// throw an exception to prevent the corruption fromdiff --cc lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.javaindex aa2fb62a372,2dfa80a8b77..23ddb272acd--- a/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java@@@ -329,17 -323,14 +329,17 @@@ public class TestBackwardsCompatibilitassertEquals("field with non-ascii name", f.stringValue());}- Terms tfv = reader.getTermVectors(i).terms("utf8");+ Fields tfvFields = reader.getTermVectors(i);+ assertNotNull("i=" + i, tfvFields);+ Terms tfv = tfvFields.terms("utf8");assertNotNull("docID=" + i + " index=" + oldName, tfv);- } else+ } else {// Only ID 7 is deletedassertEquals(7, i);+ }}- ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content", "aaa")), null, 1000).scoreDocs;+ ScoreDoc[] hits = searcher.search(new TermQuery(new Term(new String("content"), "aaa")), null, 1000).scoreDocs;// First document should be #21 since it's norm was// increased: