You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/11/01 10:32:12 UTC
svn commit: r1635908 [4/7] - in /lucene/dev/branches/lucene6005: ./
dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/scripts/ lucene/
lucene/backward-codecs/
lucene/backward-codecs/src/test/org/apache/lucene/index/ lucene/codecs/
lucene/codecs/src/...
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java Sat Nov 1 09:32:06 2014
@@ -31,7 +31,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.BaseDirectoryWrapper;
@@ -42,7 +41,6 @@ import org.apache.lucene.util.AttributeI
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase.Monster;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
-import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TimeUnits;
@@ -197,7 +195,7 @@ public class Test2BTerms extends LuceneT
final MyTokenStream ts = new MyTokenStream(random(), TERMS_PER_DOC);
FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
- customType.setIndexOptions(IndexOptions.DOCS_ONLY);
+ customType.setIndexOptions(IndexOptions.DOCS);
customType.setOmitNorms(true);
Field field = new Field("field", ts, customType);
doc.add(field);
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java Sat Nov 1 09:32:06 2014
@@ -36,7 +36,6 @@ import org.apache.lucene.document.FieldT
import org.apache.lucene.document.FieldTypes;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.PhraseQuery;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java Sat Nov 1 09:32:06 2014
@@ -28,7 +28,6 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java Sat Nov 1 09:32:06 2014
@@ -30,8 +30,6 @@ import org.apache.lucene.codecs.FieldsPr
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
@@ -111,10 +109,10 @@ public class TestCodecs extends LuceneTe
public boolean omitNorms() { return false; }
@Override
- public IndexOptions indexOptions() { return omitTF ? IndexOptions.DOCS_ONLY : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
+ public IndexOptions indexOptions() { return omitTF ? IndexOptions.DOCS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
@Override
- public DocValuesType docValueType() { return null; }
+ public DocValuesType docValueType() { return DocValuesType.NONE; }
});
if (storePayloads) {
fieldInfo.setStorePayloads();
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java Sat Nov 1 09:32:06 2014
@@ -30,7 +30,6 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.FieldTypes;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.AttributeSource;
@@ -280,7 +279,7 @@ public class TestDocumentWriter extends
// f2 has no TF
fieldTypes.disableHighlighting("f2");
- fieldTypes.setIndexOptions("f2", IndexOptions.DOCS_ONLY);
+ fieldTypes.setIndexOptions("f2", IndexOptions.DOCS);
doc.addLargeText("f2", "v1");
doc.addStored("f2", "v2");
@@ -297,7 +296,7 @@ public class TestDocumentWriter extends
assertEquals("omitTermFreqAndPositions field bit should not be set for f1", IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, fi.fieldInfo("f1").getIndexOptions());
// f2
assertTrue("f2 should have norms", fi.fieldInfo("f2").hasNorms());
- assertEquals("omitTermFreqAndPositions field bit should be set for f2", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());
+ assertEquals("omitTermFreqAndPositions field bit should be set for f2", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());
reader.close();
}
}
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java Sat Nov 1 09:32:06 2014
@@ -23,7 +23,6 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java Sat Nov 1 09:32:06 2014
@@ -17,7 +17,6 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.*;
@@ -29,7 +28,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldTypes;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.BaseDirectory;
import org.apache.lucene.store.BufferedIndexInput;
@@ -83,7 +82,7 @@ public class TestFieldsReader extends Lu
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
- assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_ONLY);
+ assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS);
FieldTypes fieldTypes = FieldTypes.getFieldTypes(dir, null);
Document2StoredFieldVisitor visitor = new Document2StoredFieldVisitor(fieldTypes, DocHelper.TEXT_FIELD_3_KEY);
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java Sat Nov 1 09:32:06 2014
@@ -55,7 +55,6 @@ import org.apache.lucene.document.Sorted
import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
@@ -1248,7 +1247,7 @@ public class TestIndexWriter extends Luc
Field f = new Field("binary", b, 10, 17, customType);
// TODO: this is evil, changing the type after creating the field:
- customType.setIndexOptions(IndexOptions.DOCS_ONLY);
+ customType.setIndexOptions(IndexOptions.DOCS);
final MockTokenizer doc1field1 = new MockTokenizer(MockTokenizer.WHITESPACE, false);
doc1field1.setReader(new StringReader("doc1field1"));
f.setTokenStream(doc1field1);
@@ -1808,7 +1807,7 @@ public class TestIndexWriter extends Luc
docsAndFreqs.setIndexOptions(IndexOptions.DOCS_AND_FREQS);
FieldType docsOnly = new FieldType(TextField.TYPE_NOT_STORED);
- docsOnly.setIndexOptions(IndexOptions.DOCS_ONLY);
+ docsOnly.setIndexOptions(IndexOptions.DOCS);
Document doc = new Document();
doc.add(new Field("field", "a b c", docsAndFreqs));
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java Sat Nov 1 09:32:06 2014
@@ -48,7 +48,6 @@ import org.apache.lucene.document.Sorted
import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.PhraseQuery;
@@ -58,8 +57,8 @@ import org.apache.lucene.store.Directory
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.MockDirectoryWrapper.FakeIOException;
+import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java Sat Nov 1 09:32:06 2014
@@ -190,7 +190,6 @@ public class TestIndexWriterNRTIsCurrent
if (failed == null) {
failed = e;
}
- return;
}
}
}
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOnJRECrash.java Sat Nov 1 09:32:06 2014
@@ -30,6 +30,7 @@ import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.lucene.store.BaseDirectoryWrapper;
@@ -47,6 +48,8 @@ public class TestIndexWriterOnJRECrash e
@Override
public void setUp() throws Exception {
super.setUp();
+ assumeFalse("This test fails on UNIX with Turkish default locale (https://issues.apache.org/jira/browse/LUCENE-6036)",
+ new Locale("tr").getLanguage().equals(Locale.getDefault().getLanguage()));
tempDir = createTempDir("jrecrash");
}
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfMemory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfMemory.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfMemory.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterOutOfMemory.java Sat Nov 1 09:32:06 2014
@@ -38,8 +38,8 @@ import org.apache.lucene.document.Sorted
import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.document.StoredField;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.MockDirectoryWrapper.Failure;
import org.apache.lucene.store.MockDirectoryWrapper;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java Sat Nov 1 09:32:06 2014
@@ -29,8 +29,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StoredField;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.DocIdSetIterator;
@@ -55,7 +54,7 @@ public class TestIndexableField extends
@Override
public boolean storeTermVectors() {
- return indexOptions() != null && counter % 2 == 1 && counter % 10 != 9;
+ return indexOptions() != IndexOptions.NONE && counter % 2 == 1 && counter % 10 != 9;
}
@Override
@@ -79,17 +78,17 @@ public class TestIndexableField extends
}
@Override
- public FieldInfo.IndexOptions indexOptions() {
+ public IndexOptions indexOptions() {
if ((counter % 10) != 3) {
- return FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+ return IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
} else {
- return null;
+ return IndexOptions.NONE;
}
}
@Override
public DocValuesType docValueType() {
- return null;
+ return DocValuesType.NONE;
}
};
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java Sat Nov 1 09:32:06 2014
@@ -18,6 +18,7 @@ package org.apache.lucene.index;
*/
import java.io.IOException;
+
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.TokenStream;
@@ -25,14 +26,13 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.document.TextField;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.TestUtil;
@SuppressCodecs({ "SimpleText", "Memory", "Direct" })
@@ -267,7 +267,7 @@ public class TestLongPostings extends Lu
// a weaker form of testLongPostings, that doesnt check positions
public void testLongPostingsNoPositions() throws Exception {
- doTestLongPostingsNoPositions(IndexOptions.DOCS_ONLY);
+ doTestLongPostingsNoPositions(IndexOptions.DOCS);
doTestLongPostingsNoPositions(IndexOptions.DOCS_AND_FREQS);
}
@@ -373,7 +373,7 @@ public class TestLongPostings extends Lu
final DocsEnum docs;
final DocsEnum postings;
- if (options == IndexOptions.DOCS_ONLY) {
+ if (options == IndexOptions.DOCS) {
docs = TestUtil.docs(random(), r, "field", new BytesRef(term), null, null, DocsEnum.FLAG_NONE);
postings = null;
} else {
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java Sat Nov 1 09:32:06 2014
@@ -23,7 +23,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
@@ -73,7 +72,7 @@ public class TestOmitPositions extends L
// f1,f2,f3: docs only
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
+ ft.setIndexOptions(IndexOptions.DOCS);
Field f1 = newField("f1", "This field has docs only", ft);
d.add(f1);
@@ -157,19 +156,19 @@ public class TestOmitPositions extends L
SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));
FieldInfos fi = reader.getFieldInfos();
// docs + docs = docs
- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());
+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());
// docs + docs/freqs = docs
- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());
+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());
// docs + docs/freqs/pos = docs
- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f3").getIndexOptions());
+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f3").getIndexOptions());
// docs/freqs + docs = docs
- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f4").getIndexOptions());
+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f4").getIndexOptions());
// docs/freqs + docs/freqs = docs/freqs
assertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f5").getIndexOptions());
// docs/freqs + docs/freqs/pos = docs/freqs
assertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f6").getIndexOptions());
// docs/freqs/pos + docs = docs
- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f7").getIndexOptions());
+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f7").getIndexOptions());
// docs/freqs/pos + docs/freqs = docs/freqs
assertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f8").getIndexOptions());
// docs/freqs/pos + docs/freqs/pos = docs/freqs/pos
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java Sat Nov 1 09:32:06 2014
@@ -25,7 +25,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.CollectionStatistics;
@@ -66,7 +65,7 @@ public class TestOmitTf extends LuceneTe
private static final FieldType normalType = new FieldType(TextField.TYPE_NOT_STORED);
static {
- omitType.setIndexOptions(IndexOptions.DOCS_ONLY);
+ omitType.setIndexOptions(IndexOptions.DOCS);
}
// Tests whether the DocumentWriter correctly enable the
@@ -107,8 +106,8 @@ public class TestOmitTf extends LuceneTe
SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));
FieldInfos fi = reader.getFieldInfos();
- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());
- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());
+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());
+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());
reader.close();
ram.close();
@@ -159,8 +158,8 @@ public class TestOmitTf extends LuceneTe
SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));
FieldInfos fi = reader.getFieldInfos();
- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());
- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());
+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());
+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());
reader.close();
ram.close();
@@ -203,7 +202,7 @@ public class TestOmitTf extends LuceneTe
SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));
FieldInfos fi = reader.getFieldInfos();
assertEquals("OmitTermFreqAndPositions field bit should not be set.", IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, fi.fieldInfo("f1").getIndexOptions());
- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());
+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());
reader.close();
ram.close();
@@ -451,7 +450,7 @@ public class TestOmitTf extends LuceneTe
newIndexWriterConfig(new MockAnalyzer(random())));
Document doc = new Document();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
+ ft.setIndexOptions(IndexOptions.DOCS);
ft.freeze();
Field f = newField("foo", "bar", ft);
doc.add(f);
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java Sat Nov 1 09:32:06 2014
@@ -37,7 +37,6 @@ import org.apache.lucene.document.IntFie
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
@@ -65,7 +64,7 @@ public class TestPostingsOffsets extends
Document doc = new Document();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
if (random().nextBoolean()) {
ft.setStoreTermVectors(true);
ft.setStoreTermVectorPositions(random().nextBoolean());
@@ -133,7 +132,7 @@ public class TestPostingsOffsets extends
RandomIndexWriter w = new RandomIndexWriter(random(), dir, iwc);
FieldType ft = new FieldType(TextField.TYPE_STORED);
- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
if (random().nextBoolean()) {
ft.setStoreTermVectors(true);
ft.setStoreTermVectorOffsets(random().nextBoolean());
@@ -231,7 +230,7 @@ public class TestPostingsOffsets extends
// TODO: randomize what IndexOptions we use; also test
// changing this up in one IW buffered segment...:
- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
if (random().nextBoolean()) {
ft.setStoreTermVectors(true);
ft.setStoreTermVectorOffsets(random().nextBoolean());
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java Sat Nov 1 09:32:06 2014
@@ -169,7 +169,7 @@ public class TestSegmentReader extends L
public static void checkNorms(FieldTypes fieldTypes, LeafReader reader) throws IOException {
// test omit norms
for (String fieldName : fieldTypes.getFieldNames()) {
- if (fieldTypes.getIndexOptions(fieldName) != null) {
+ if (fieldTypes.getIndexOptions(fieldName) != IndexOptions.NONE) {
assertEquals("field " + fieldName, reader.getNormValues(fieldName) != null, fieldTypes.getNorms(fieldName));
if (reader.getNormValues(fieldName) == null) {
// test for norms of null
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java Sat Nov 1 09:32:06 2014
@@ -32,7 +32,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.TermQuery;
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java Sat Nov 1 09:32:06 2014
@@ -24,7 +24,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -163,7 +163,7 @@ public class TestSimilarity2 extends Luc
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
+ ft.setIndexOptions(IndexOptions.DOCS);
ft.freeze();
Field f = newField("foo", "bar", ft);
doc.add(f);
@@ -188,7 +188,7 @@ public class TestSimilarity2 extends Luc
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
+ ft.setIndexOptions(IndexOptions.DOCS);
ft.setOmitNorms(true);
ft.freeze();
Field f = newField("foo", "bar", ft);
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java Sat Nov 1 09:32:06 2014
@@ -26,6 +26,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInvertState;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -111,7 +112,7 @@ public class TestSimilarityBase extends
for (int i = 0; i < docs.length; i++) {
Document d = new Document();
FieldType ft = new FieldType(TextField.TYPE_STORED);
- ft.setIndexOptions(null);
+ ft.setIndexOptions(IndexOptions.NONE);
d.add(newField(FIELD_ID, Integer.toString(i), ft));
d.add(newTextField(FIELD_BODY, docs[i], Field.Store.YES));
writer.addDocument(d);
Modified: lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java (original)
+++ lucene/dev/branches/lucene6005/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java Sat Nov 1 09:32:06 2014
@@ -25,7 +25,7 @@ import org.apache.lucene.search.DocIdSet
public class TestDocIdSetBuilder extends LuceneTestCase {
public void testEmpty() throws IOException {
- assertEquals(null, new DocIdSetBuilder(1 + random().nextInt(1000)).build());
+ assertEquals(null, new BitDocIdSet.Builder(1 + random().nextInt(1000)).build());
}
private void assertEquals(DocIdSet d1, DocIdSet d2) throws IOException {
@@ -47,7 +47,7 @@ public class TestDocIdSetBuilder extends
public void testFull() throws IOException {
final int maxDoc = 1 + random().nextInt(1000);
- DocIdSetBuilder builder = new DocIdSetBuilder(maxDoc, true);
+ BitDocIdSet.Builder builder = new BitDocIdSet.Builder(maxDoc, true);
DocIdSet set = builder.build();
DocIdSetIterator it = set.iterator();
for (int i = 0; i < maxDoc; ++i) {
@@ -57,7 +57,7 @@ public class TestDocIdSetBuilder extends
public void testSparse() throws IOException {
final int maxDoc = 1000000 + random().nextInt(1000000);
- DocIdSetBuilder builder = new DocIdSetBuilder(maxDoc);
+ BitDocIdSet.Builder builder = new BitDocIdSet.Builder(maxDoc);
final int numIterators = 1 + random().nextInt(10);
final FixedBitSet ref = new FixedBitSet(maxDoc);
for (int i = 0; i < numIterators; ++i) {
@@ -76,7 +76,7 @@ public class TestDocIdSetBuilder extends
public void testDense() throws IOException {
final int maxDoc = 1000000 + random().nextInt(1000000);
- DocIdSetBuilder builder = new DocIdSetBuilder(maxDoc);
+ BitDocIdSet.Builder builder = new BitDocIdSet.Builder(maxDoc);
final int numIterators = 1 + random().nextInt(10);
final FixedBitSet ref = new FixedBitSet(maxDoc);
if (random().nextBoolean()) {
Modified: lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java Sat Nov 1 09:32:06 2014
@@ -22,7 +22,7 @@ import java.util.Arrays;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
/**
* Add an instance of this to your {@link Document} for every facet label.
Modified: lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java Sat Nov 1 09:32:06 2014
@@ -20,7 +20,7 @@ package org.apache.lucene.facet.sortedse
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.facet.FacetField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
/** Add an instance of this to your Document for every facet
* label to be indexed via SortedSetDocValues. */
Modified: lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java Sat Nov 1 09:32:06 2014
@@ -24,7 +24,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.facet.FacetField;
import org.apache.lucene.facet.Facets;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.util.BytesRef;
/** Add an instance of this to your {@link Document} to add
Modified: lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java (original)
+++ lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java Sat Nov 1 09:32:06 2014
@@ -35,7 +35,7 @@ import org.apache.lucene.document.IntFie
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.FieldInfo.DocValuesType;
+import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiDocValues;
import org.apache.lucene.index.NumericDocValues;
Modified: lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (original)
+++ lucene/dev/branches/lucene6005/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java Sat Nov 1 09:32:06 2014
@@ -17,16 +17,19 @@
package org.apache.lucene.search.grouping;
+import java.io.IOException;
+import java.util.*;
+
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.*;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexOptions;
+import org.apache.lucene.index.IndexReaderContext;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.MultiDocValues;
import org.apache.lucene.index.NumericDocValues;
-import org.apache.lucene.index.ReaderUtil;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.RandomIndexWriter;
-import org.apache.lucene.index.IndexReaderContext;
+import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.SlowCompositeReaderWrapper;
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.function.ValueSource;
@@ -45,9 +48,6 @@ import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.mutable.MutableValue;
import org.apache.lucene.util.mutable.MutableValueStr;
-import java.io.IOException;
-import java.util.*;
-
// TODO
// - should test relevance sort too
// - test null
@@ -551,7 +551,7 @@ public class TestGrouping extends Lucene
final List<List<Document>> updateDocs = new ArrayList<>();
FieldType groupEndType = new FieldType(StringField.TYPE_NOT_STORED);
- groupEndType.setIndexOptions(IndexOptions.DOCS_ONLY);
+ groupEndType.setIndexOptions(IndexOptions.DOCS);
groupEndType.setOmitNorms(true);
//System.out.println("TEST: index groups");
Modified: lucene/dev/branches/lucene6005/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java Sat Nov 1 09:32:06 2014
@@ -31,13 +31,13 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.index.ReaderUtil;
import org.apache.lucene.index.StoredFieldVisitor;
Modified: lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java (original)
+++ lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java Sat Nov 1 09:32:06 2014
@@ -24,11 +24,11 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.queries.TermFilter;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
Modified: lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java (original)
+++ lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java Sat Nov 1 09:32:06 2014
@@ -34,7 +34,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
Modified: lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java (original)
+++ lucene/dev/branches/lucene6005/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java Sat Nov 1 09:32:06 2014
@@ -28,7 +28,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
Modified: lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java Sat Nov 1 09:32:06 2014
@@ -25,16 +25,15 @@ import java.util.Set;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term;
-import org.apache.lucene.search.DocIdSet;
+import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.Filter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
-import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BitDocIdSet;
-import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.BitSet;
+import org.apache.lucene.util.Bits;
/**
* Just like {@link ToParentBlockJoinQuery}, except this
@@ -52,7 +51,7 @@ public class ToChildBlockJoinQuery exten
* when the parent query incorrectly returns child docs. */
static final String INVALID_QUERY_MESSAGE = "Parent query yields document which is not matched by parents filter, docID=";
- private final Filter parentsFilter;
+ private final BitDocIdSetFilter parentsFilter;
private final Query parentQuery;
// If we are rewritten, this is the original parentQuery we
@@ -67,12 +66,10 @@ public class ToChildBlockJoinQuery exten
* Create a ToChildBlockJoinQuery.
*
* @param parentQuery Query that matches parent documents
- * @param parentsFilter Filter (must produce FixedBitSet
- * per-segment, like {@link FixedBitSetCachingWrapperFilter})
- * identifying the parent documents.
+ * @param parentsFilter Filter identifying the parent documents.
* @param doScores true if parent scores should be calculated
*/
- public ToChildBlockJoinQuery(Query parentQuery, Filter parentsFilter, boolean doScores) {
+ public ToChildBlockJoinQuery(Query parentQuery, BitDocIdSetFilter parentsFilter, boolean doScores) {
super();
this.origParentQuery = parentQuery;
this.parentQuery = parentQuery;
@@ -80,7 +77,7 @@ public class ToChildBlockJoinQuery exten
this.doScores = doScores;
}
- private ToChildBlockJoinQuery(Query origParentQuery, Query parentQuery, Filter parentsFilter, boolean doScores) {
+ private ToChildBlockJoinQuery(Query origParentQuery, Query parentQuery, BitDocIdSetFilter parentsFilter, boolean doScores) {
super();
this.origParentQuery = origParentQuery;
this.parentQuery = parentQuery;
@@ -96,10 +93,10 @@ public class ToChildBlockJoinQuery exten
private static class ToChildBlockJoinWeight extends Weight {
private final Query joinQuery;
private final Weight parentWeight;
- private final Filter parentsFilter;
+ private final BitDocIdSetFilter parentsFilter;
private final boolean doScores;
- public ToChildBlockJoinWeight(Query joinQuery, Weight parentWeight, Filter parentsFilter, boolean doScores) {
+ public ToChildBlockJoinWeight(Query joinQuery, Weight parentWeight, BitDocIdSetFilter parentsFilter, boolean doScores) {
super();
this.joinQuery = joinQuery;
this.parentWeight = parentWeight;
@@ -134,22 +131,15 @@ public class ToChildBlockJoinQuery exten
return null;
}
- // NOTE: we cannot pass acceptDocs here because this
- // will (most likely, justifiably) cause the filter to
- // not return a FixedBitSet but rather a
- // BitsFilteredDocIdSet. Instead, we filter by
- // acceptDocs when we score:
- final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, null);
-
+ // NOTE: this doesn't take acceptDocs into account, the responsibility
+ // to not match deleted docs is on the scorer
+ final BitDocIdSet parents = parentsFilter.getDocIdSet(readerContext);
if (parents == null) {
- // No matches
+ // No parents
return null;
}
- if (!(parents.bits() instanceof FixedBitSet)) {
- throw new IllegalStateException("parentFilter must return FixedBitSet; got " + parents.bits());
- }
- return new ToChildBlockJoinScorer(this, parentScorer, (FixedBitSet) parents.bits(), doScores, acceptDocs);
+ return new ToChildBlockJoinScorer(this, parentScorer, parents.bits(), doScores, acceptDocs);
}
@Override
@@ -167,7 +157,7 @@ public class ToChildBlockJoinQuery exten
static class ToChildBlockJoinScorer extends Scorer {
private final Scorer parentScorer;
- private final FixedBitSet parentBits;
+ private final BitSet parentBits;
private final boolean doScores;
private final Bits acceptDocs;
@@ -177,7 +167,7 @@ public class ToChildBlockJoinQuery exten
private int childDoc = -1;
private int parentDoc;
- public ToChildBlockJoinScorer(Weight weight, Scorer parentScorer, FixedBitSet parentBits, boolean doScores, Bits acceptDocs) {
+ public ToChildBlockJoinScorer(Weight weight, Scorer parentScorer, BitSet parentBits, boolean doScores, Bits acceptDocs) {
super(weight);
this.doScores = doScores;
this.parentBits = parentBits;
Modified: lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinFieldComparator.java Sat Nov 1 09:32:06 2014
@@ -20,11 +20,10 @@ package org.apache.lucene.search.join;
import java.io.IOException;
import org.apache.lucene.index.LeafReaderContext;
-import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.FieldComparator;
-import org.apache.lucene.search.Filter;
-import org.apache.lucene.util.FixedBitSet;
+import org.apache.lucene.util.BitDocIdSet;
+import org.apache.lucene.util.BitSet;
/**
* A field comparator that allows parent documents to be sorted by fields
@@ -34,15 +33,15 @@ import org.apache.lucene.util.FixedBitSe
*/
public abstract class ToParentBlockJoinFieldComparator extends FieldComparator<Object> {
- private final Filter parentFilter;
- private final Filter childFilter;
+ private final BitDocIdSetFilter parentFilter;
+ private final BitDocIdSetFilter childFilter;
final int spareSlot;
FieldComparator<Object> wrappedComparator;
- FixedBitSet parentDocuments;
- FixedBitSet childDocuments;
+ BitSet parentDocuments;
+ BitSet childDocuments;
- ToParentBlockJoinFieldComparator(FieldComparator<Object> wrappedComparator, Filter parentFilter, Filter childFilter, int spareSlot) {
+ ToParentBlockJoinFieldComparator(FieldComparator<Object> wrappedComparator, BitDocIdSetFilter parentFilter, BitDocIdSetFilter childFilter, int spareSlot) {
this.wrappedComparator = wrappedComparator;
this.parentFilter = parentFilter;
this.childFilter = childFilter;
@@ -66,50 +65,22 @@ public abstract class ToParentBlockJoinF
@Override
public FieldComparator<Object> setNextReader(LeafReaderContext context) throws IOException {
- DocIdSet innerDocuments = childFilter.getDocIdSet(context, null);
- if (isEmpty(innerDocuments)) {
- this.childDocuments = null;
- } else if (innerDocuments.bits() instanceof FixedBitSet) {
- this.childDocuments = (FixedBitSet) innerDocuments.bits();
+ BitDocIdSet children = childFilter.getDocIdSet(context);
+ if (children == null) {
+ childDocuments = null;
} else {
- DocIdSetIterator iterator = innerDocuments.iterator();
- if (iterator != null) {
- this.childDocuments = toFixedBitSet(iterator, context.reader().maxDoc());
- } else {
- childDocuments = null;
- }
+ childDocuments = children.bits();
}
- DocIdSet rootDocuments = parentFilter.getDocIdSet(context, null);
- if (isEmpty(rootDocuments)) {
- this.parentDocuments = null;
- } else if (rootDocuments.bits() instanceof FixedBitSet) {
- this.parentDocuments = (FixedBitSet) rootDocuments.bits();
+ BitDocIdSet parents = parentFilter.getDocIdSet(context);
+ if (parents == null) {
+ parentDocuments = null;
} else {
- DocIdSetIterator iterator = rootDocuments.iterator();
- if (iterator != null) {
- this.parentDocuments = toFixedBitSet(iterator, context.reader().maxDoc());
- } else {
- this.parentDocuments = null;
- }
+ parentDocuments = parents.bits();
}
-
wrappedComparator = wrappedComparator.setNextReader(context);
return this;
}
- private static boolean isEmpty(DocIdSet set) {
- return set == null;
- }
-
- private static FixedBitSet toFixedBitSet(DocIdSetIterator iterator, int numBits) throws IOException {
- FixedBitSet set = new FixedBitSet(numBits);
- int doc;
- while ((doc = iterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
- set.set(doc);
- }
- return set;
- }
-
@Override
public Object value(int slot) {
return wrappedComparator.value(slot);
@@ -125,12 +96,12 @@ public abstract class ToParentBlockJoinF
* Create ToParentBlockJoinFieldComparator.Lowest
*
* @param wrappedComparator The {@link FieldComparator} on the child / nested level.
- * @param parentFilter Filter (must produce FixedBitSet per-segment) that identifies the parent documents.
+ * @param parentFilter Filter that identifies the parent documents.
* @param childFilter Filter that defines which child / nested documents participates in sorting.
* @param spareSlot The extra slot inside the wrapped comparator that is used to compare which nested document
* inside the parent document scope is most competitive.
*/
- public Lowest(FieldComparator<Object> wrappedComparator, Filter parentFilter, Filter childFilter, int spareSlot) {
+ public Lowest(FieldComparator<Object> wrappedComparator, BitDocIdSetFilter parentFilter, BitDocIdSetFilter childFilter, int spareSlot) {
super(wrappedComparator, parentFilter, childFilter, spareSlot);
}
@@ -244,12 +215,12 @@ public abstract class ToParentBlockJoinF
* Create ToParentBlockJoinFieldComparator.Highest
*
* @param wrappedComparator The {@link FieldComparator} on the child / nested level.
- * @param parentFilter Filter (must produce FixedBitSet per-segment) that identifies the parent documents.
+ * @param parentFilter Filter that identifies the parent documents.
* @param childFilter Filter that defines which child / nested documents participates in sorting.
* @param spareSlot The extra slot inside the wrapped comparator that is used to compare which nested document
* inside the parent document scope is most competitive.
*/
- public Highest(FieldComparator<Object> wrappedComparator, Filter parentFilter, Filter childFilter, int spareSlot) {
+ public Highest(FieldComparator<Object> wrappedComparator, BitDocIdSetFilter parentFilter, BitDocIdSetFilter childFilter, int spareSlot) {
super(wrappedComparator, parentFilter, childFilter, spareSlot);
}
Modified: lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java Sat Nov 1 09:32:06 2014
@@ -28,18 +28,17 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.ComplexExplanation;
-import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Explanation;
-import org.apache.lucene.search.Filter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.grouping.TopGroups;
import org.apache.lucene.util.ArrayUtil;
+import org.apache.lucene.util.BitDocIdSet;
+import org.apache.lucene.util.BitSet;
import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.FixedBitSet;
/**
* This query requires that you index
@@ -49,7 +48,7 @@ import org.apache.lucene.util.FixedBitSe
* child documents must appear first, ending with the parent
* document. At search time you provide a Filter
* identifying the parents, however this Filter must provide
- * an {@link FixedBitSet} per sub-reader.
+ * an {@link BitSet} per sub-reader.
*
* <p>Once the block index is built, use this query to wrap
* any sub-query matching only child docs and join matches in that
@@ -85,7 +84,7 @@ import org.apache.lucene.util.FixedBitSe
*/
public class ToParentBlockJoinQuery extends Query {
- private final Filter parentsFilter;
+ private final BitDocIdSetFilter parentsFilter;
private final Query childQuery;
// If we are rewritten, this is the original childQuery we
@@ -99,13 +98,11 @@ public class ToParentBlockJoinQuery exte
/** Create a ToParentBlockJoinQuery.
*
* @param childQuery Query matching child documents.
- * @param parentsFilter Filter (must produce FixedBitSet
- * per-segment, like {@link FixedBitSetCachingWrapperFilter})
- * identifying the parent documents.
+ * @param parentsFilter Filter identifying the parent documents.
* @param scoreMode How to aggregate multiple child scores
* into a single parent score.
**/
- public ToParentBlockJoinQuery(Query childQuery, Filter parentsFilter, ScoreMode scoreMode) {
+ public ToParentBlockJoinQuery(Query childQuery, BitDocIdSetFilter parentsFilter, ScoreMode scoreMode) {
super();
this.origChildQuery = childQuery;
this.childQuery = childQuery;
@@ -113,7 +110,7 @@ public class ToParentBlockJoinQuery exte
this.scoreMode = scoreMode;
}
- private ToParentBlockJoinQuery(Query origChildQuery, Query childQuery, Filter parentsFilter, ScoreMode scoreMode) {
+ private ToParentBlockJoinQuery(Query origChildQuery, Query childQuery, BitDocIdSetFilter parentsFilter, ScoreMode scoreMode) {
super();
this.origChildQuery = origChildQuery;
this.childQuery = childQuery;
@@ -129,10 +126,10 @@ public class ToParentBlockJoinQuery exte
private static class BlockJoinWeight extends Weight {
private final Query joinQuery;
private final Weight childWeight;
- private final Filter parentsFilter;
+ private final BitDocIdSetFilter parentsFilter;
private final ScoreMode scoreMode;
- public BlockJoinWeight(Query joinQuery, Weight childWeight, Filter parentsFilter, ScoreMode scoreMode) {
+ public BlockJoinWeight(Query joinQuery, Weight childWeight, BitDocIdSetFilter parentsFilter, ScoreMode scoreMode) {
super();
this.joinQuery = joinQuery;
this.childWeight = childWeight;
@@ -172,22 +169,16 @@ public class ToParentBlockJoinQuery exte
return null;
}
- // NOTE: we cannot pass acceptDocs here because this
- // will (most likely, justifiably) cause the filter to
- // not return a FixedBitSet but rather a
- // BitsFilteredDocIdSet. Instead, we filter by
- // acceptDocs when we score:
- final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, null);
+ // NOTE: this does not take accept docs into account, the responsibility
+ // to not match deleted docs is on the scorer
+ final BitDocIdSet parents = parentsFilter.getDocIdSet(readerContext);
if (parents == null) {
// No matches
return null;
}
- if (!(parents.bits() instanceof FixedBitSet)) {
- throw new IllegalStateException("parentFilter must return FixedBitSet; got " + parents.bits());
- }
- return new BlockJoinScorer(this, childScorer, (FixedBitSet) parents.bits(), firstChildDoc, scoreMode, acceptDocs);
+ return new BlockJoinScorer(this, childScorer, parents.bits(), firstChildDoc, scoreMode, acceptDocs);
}
@Override
@@ -207,7 +198,7 @@ public class ToParentBlockJoinQuery exte
static class BlockJoinScorer extends Scorer {
private final Scorer childScorer;
- private final FixedBitSet parentBits;
+ private final BitSet parentBits;
private final ScoreMode scoreMode;
private final Bits acceptDocs;
private int parentDoc = -1;
@@ -219,7 +210,7 @@ public class ToParentBlockJoinQuery exte
private float[] pendingChildScores;
private int childDocUpto;
- public BlockJoinScorer(Weight weight, Scorer childScorer, FixedBitSet parentBits, int firstChildDoc, ScoreMode scoreMode, Bits acceptDocs) {
+ public BlockJoinScorer(Weight weight, Scorer childScorer, BitSet parentBits, int firstChildDoc, ScoreMode scoreMode, Bits acceptDocs) {
super(weight);
//System.out.println("Q.init firstChildDoc=" + firstChildDoc);
this.parentBits = parentBits;
Modified: lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinSortField.java Sat Nov 1 09:32:06 2014
@@ -18,7 +18,6 @@ package org.apache.lucene.search.join;
*/
import org.apache.lucene.search.FieldComparator;
-import org.apache.lucene.search.Filter;
import org.apache.lucene.search.SortField;
import java.io.IOException;
@@ -32,8 +31,8 @@ import java.io.IOException;
public class ToParentBlockJoinSortField extends SortField {
private final boolean order;
- private final Filter parentFilter;
- private final Filter childFilter;
+ private final BitDocIdSetFilter parentFilter;
+ private final BitDocIdSetFilter childFilter;
/**
* Create ToParentBlockJoinSortField. The parent document ordering is based on child document ordering (reverse).
@@ -44,7 +43,7 @@ public class ToParentBlockJoinSortField
* @param parentFilter Filter that identifies the parent documents.
* @param childFilter Filter that defines which child documents participates in sorting.
*/
- public ToParentBlockJoinSortField(String field, Type type, boolean reverse, Filter parentFilter, Filter childFilter) {
+ public ToParentBlockJoinSortField(String field, Type type, boolean reverse, BitDocIdSetFilter parentFilter, BitDocIdSetFilter childFilter) {
super(field, type, reverse);
this.order = reverse;
this.parentFilter = parentFilter;
@@ -61,7 +60,7 @@ public class ToParentBlockJoinSortField
* @param parentFilter Filter that identifies the parent documents.
* @param childFilter Filter that defines which child documents participates in sorting.
*/
- public ToParentBlockJoinSortField(String field, Type type, boolean reverse, boolean order, Filter parentFilter, Filter childFilter) {
+ public ToParentBlockJoinSortField(String field, Type type, boolean reverse, boolean order, BitDocIdSetFilter parentFilter, BitDocIdSetFilter childFilter) {
super(field, type, reverse);
this.order = order;
this.parentFilter = parentFilter;
Modified: lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java Sat Nov 1 09:32:06 2014
@@ -93,7 +93,7 @@ public class TestBlockJoin extends Lucen
w.close();
assertTrue(r.leaves().size() > 1);
IndexSearcher s = new IndexSearcher(r);
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
BooleanQuery childQuery = new BooleanQuery();
childQuery.add(new BooleanClause(new TermQuery(new Term("skill", "java")), Occur.MUST));
@@ -145,7 +145,7 @@ public class TestBlockJoin extends Lucen
IndexSearcher s = newSearcher(r);
// Create a filter that defines "parent" documents in the index - in this case resumes
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
// Define child document criteria (finds an example of relevant work experience)
BooleanQuery childQuery = new BooleanQuery();
@@ -236,7 +236,7 @@ public class TestBlockJoin extends Lucen
// iterations:
qc.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
int h1 = qc.hashCode();
Query qw1 = qc.rewrite(r);
@@ -297,7 +297,7 @@ public class TestBlockJoin extends Lucen
IndexSearcher s = newSearcher(r);
// Create a filter that defines "parent" documents in the index - in this case resumes
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
// Define child document criteria (finds an example of relevant work experience)
BooleanQuery childQuery = new BooleanQuery();
@@ -317,7 +317,7 @@ public class TestBlockJoin extends Lucen
assertEquals("dummy filter passes everyone ", 2, s.search(childJoinQuery, new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))), 10).totalHits);
// not found test
- assertEquals("noone live there", 0, s.search(childJoinQuery, new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("country", "Oz")))), 1).totalHits);
+ assertEquals("noone live there", 0, s.search(childJoinQuery, new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("country", "Oz")))), 1).totalHits);
assertEquals("noone live there", 0, s.search(childJoinQuery, new QueryWrapperFilter(new TermQuery(new Term("country", "Oz"))), 1).totalHits);
// apply the UK filter by the searcher
@@ -355,11 +355,11 @@ public class TestBlockJoin extends Lucen
}
}
- private Document2 getParentDoc(IndexReader reader, Filter parents, int childDocID) throws IOException {
+ private Document2 getParentDoc(IndexReader reader, BitDocIdSetFilter parents, int childDocID) throws IOException {
final List<LeafReaderContext> leaves = reader.leaves();
final int subIndex = ReaderUtil.subIndex(childDocID, leaves);
final LeafReaderContext leaf = leaves.get(subIndex);
- final FixedBitSet bits = (FixedBitSet) parents.getDocIdSet(leaf, null).bits();
+ final BitSet bits = (BitSet) parents.getDocIdSet(leaf).bits();
return leaf.reader().document(bits.nextSetBit(childDocID - leaf.docBase));
}
@@ -370,7 +370,7 @@ public class TestBlockJoin extends Lucen
w.close();
IndexSearcher s = newSearcher(r);
- ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(new MatchAllDocsQuery(), new QueryWrapperFilter(new MatchAllDocsQuery()), ScoreMode.Avg);
+ ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(new MatchAllDocsQuery(), new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new MatchAllDocsQuery())), ScoreMode.Avg);
QueryUtils.check(random(), q, s);
s.search(q, 10);
BooleanQuery bq = new BooleanQuery();
@@ -409,7 +409,7 @@ public class TestBlockJoin extends Lucen
ToParentBlockJoinQuery q = new ToParentBlockJoinQuery(
NumericRangeQuery.newIntRange("year", 1990, 2010, true, true),
- new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume")))),
+ new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume")))),
ScoreMode.Total
);
@@ -635,7 +635,7 @@ public class TestBlockJoin extends Lucen
final IndexSearcher joinS = new IndexSearcher(joinR);
- final Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "x"))));
+ final BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "x"))));
final int iters = 200*RANDOM_MULTIPLIER;
@@ -902,7 +902,7 @@ public class TestBlockJoin extends Lucen
childJoinQuery2 = parentJoinQuery2;
final Filter f = new QueryWrapperFilter(new TermQuery(childTerm));
childJoinFilter2 = random().nextBoolean()
- ? new FixedBitSetCachingWrapperFilter(f): f;
+ ? new BitDocIdSetCachingWrapperFilter(f): f;
} else {
childJoinFilter2 = null;
// AND child field w/ parent query:
@@ -923,7 +923,7 @@ public class TestBlockJoin extends Lucen
childQuery2 = parentQuery2;
final Filter f = new QueryWrapperFilter(new TermQuery(childTerm));
childFilter2 = random().nextBoolean()
- ? new FixedBitSetCachingWrapperFilter(f): f;
+ ? new BitDocIdSetCachingWrapperFilter(f): f;
} else {
childFilter2 = null;
final BooleanQuery bq2 = new BooleanQuery();
@@ -1062,7 +1062,7 @@ public class TestBlockJoin extends Lucen
IndexSearcher s = newSearcher(r);
// Create a filter that defines "parent" documents in the index - in this case resumes
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
// Define child document criteria (finds an example of relevant work experience)
BooleanQuery childJobQuery = new BooleanQuery();
@@ -1142,7 +1142,7 @@ public class TestBlockJoin extends Lucen
w.close();
IndexSearcher s = newSearcher(r);
Query tq = new TermQuery(new Term("child", "1"));
- Filter parentFilter = new FixedBitSetCachingWrapperFilter(
+ BitDocIdSetFilter parentFilter = new BitDocIdSetCachingWrapperFilter(
new QueryWrapperFilter(
new TermQuery(new Term("parent", "1"))));
@@ -1176,7 +1176,7 @@ public class TestBlockJoin extends Lucen
w.close();
IndexSearcher s = newSearcher(r);
Query tq = new TermQuery(new Term("child", "2"));
- Filter parentFilter = new FixedBitSetCachingWrapperFilter(
+ BitDocIdSetFilter parentFilter = new BitDocIdSetCachingWrapperFilter(
new QueryWrapperFilter(
new TermQuery(new Term("isparent", "yes"))));
@@ -1210,7 +1210,7 @@ public class TestBlockJoin extends Lucen
IndexSearcher s = new IndexSearcher(r);
// Create a filter that defines "parent" documents in the index - in this case resumes
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("docType", "resume"))));
// Define child document criteria (finds an example of relevant work experience)
BooleanQuery childQuery = new BooleanQuery();
@@ -1313,7 +1313,7 @@ public class TestBlockJoin extends Lucen
w.close();
Query childQuery = new TermQuery(new Term("childText", "text"));
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
ToParentBlockJoinQuery childJoinQuery = new ToParentBlockJoinQuery(childQuery, parentsFilter, ScoreMode.Avg);
BooleanQuery parentQuery = new BooleanQuery();
parentQuery.add(childJoinQuery, Occur.SHOULD);
@@ -1378,7 +1378,7 @@ public class TestBlockJoin extends Lucen
// never matches:
Query childQuery = new TermQuery(new Term("childText", "bogus"));
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
ToParentBlockJoinQuery childJoinQuery = new ToParentBlockJoinQuery(childQuery, parentsFilter, ScoreMode.Avg);
BooleanQuery parentQuery = new BooleanQuery();
parentQuery.add(childJoinQuery, Occur.SHOULD);
@@ -1443,7 +1443,7 @@ public class TestBlockJoin extends Lucen
// illegally matches parent:
Query childQuery = new TermQuery(new Term("parentText", "text"));
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isParent", "yes"))));
ToParentBlockJoinQuery childJoinQuery = new ToParentBlockJoinQuery(childQuery, parentsFilter, ScoreMode.Avg);
BooleanQuery parentQuery = new BooleanQuery();
parentQuery.add(childJoinQuery, Occur.SHOULD);
@@ -1495,7 +1495,7 @@ public class TestBlockJoin extends Lucen
IndexSearcher s = newSearcher(r);
// Create a filter that defines "parent" documents in the index - in this case resumes
- Filter parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isparent", "yes"))));
+ BitDocIdSetFilter parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("isparent", "yes"))));
Query parentQuery = new TermQuery(new Term("parent", "2"));
Modified: lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinSorting.java Sat Nov 1 09:32:06 2014
@@ -231,17 +231,17 @@ public class TestBlockJoinSorting extend
IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(w.w, false));
w.close();
- Filter parentFilter = new QueryWrapperFilter(new TermQuery(new Term("__type", "parent")));
- Filter childFilter = new QueryWrapperFilter(new PrefixQuery(new Term("field2")));
+ BitDocIdSetFilter parentFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery(new Term("__type", "parent"))));
+ BitDocIdSetFilter childFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new PrefixQuery(new Term("field2"))));
ToParentBlockJoinQuery query = new ToParentBlockJoinQuery(
new FilteredQuery(new MatchAllDocsQuery(), childFilter),
- new FixedBitSetCachingWrapperFilter(parentFilter),
+ new BitDocIdSetCachingWrapperFilter(parentFilter),
ScoreMode.None
);
// Sort by field ascending, order first
ToParentBlockJoinSortField sortField = new ToParentBlockJoinSortField(
- "field2", SortField.Type.STRING, false, wrap(parentFilter), wrap(childFilter)
+ "field2", SortField.Type.STRING, false, parentFilter, childFilter
);
Sort sort = new Sort(sortField);
TopFieldDocs topDocs = searcher.search(query, 5, sort);
@@ -260,7 +260,7 @@ public class TestBlockJoinSorting extend
// Sort by field ascending, order last
sortField = new ToParentBlockJoinSortField(
- "field2", SortField.Type.STRING, false, true, wrap(parentFilter), wrap(childFilter)
+ "field2", SortField.Type.STRING, false, true, parentFilter, childFilter
);
sort = new Sort(sortField);
topDocs = searcher.search(query, 5, sort);
@@ -279,7 +279,7 @@ public class TestBlockJoinSorting extend
// Sort by field descending, order last
sortField = new ToParentBlockJoinSortField(
- "field2", SortField.Type.STRING, true, wrap(parentFilter), wrap(childFilter)
+ "field2", SortField.Type.STRING, true, parentFilter, childFilter
);
sort = new Sort(sortField);
topDocs = searcher.search(query, 5, sort);
@@ -297,14 +297,14 @@ public class TestBlockJoinSorting extend
assertEquals("g", ((BytesRef) ((FieldDoc) topDocs.scoreDocs[4]).fields[0]).utf8ToString());
// Sort by field descending, order last, sort filter (filter_1:T)
- childFilter = new QueryWrapperFilter(new TermQuery((new Term("filter_1", "T"))));
+ childFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new TermQuery((new Term("filter_1", "T")))));
query = new ToParentBlockJoinQuery(
new FilteredQuery(new MatchAllDocsQuery(), childFilter),
- new FixedBitSetCachingWrapperFilter(parentFilter),
+ new BitDocIdSetCachingWrapperFilter(parentFilter),
ScoreMode.None
);
sortField = new ToParentBlockJoinSortField(
- "field2", SortField.Type.STRING, true, wrap(parentFilter), wrap(childFilter)
+ "field2", SortField.Type.STRING, true, parentFilter, childFilter
);
sort = new Sort(sortField);
topDocs = searcher.search(query, 5, sort);
@@ -325,8 +325,4 @@ public class TestBlockJoinSorting extend
dir.close();
}
- private Filter wrap(Filter filter) {
- return random().nextBoolean() ? new FixedBitSetCachingWrapperFilter(filter) : filter;
- }
-
}
Modified: lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java?rev=1635908&r1=1635907&r2=1635908&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java (original)
+++ lucene/dev/branches/lucene6005/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinValidation.java Sat Nov 1 09:32:06 2014
@@ -17,6 +17,9 @@ package org.apache.lucene.search.join;
* limitations under the License.
*/
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
@@ -27,7 +30,6 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.Filter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryWrapperFilter;
@@ -41,9 +43,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import java.util.ArrayList;
-import java.util.List;
-
public class TestBlockJoinValidation extends LuceneTestCase {
public static final int AMOUNT_OF_SEGMENTS = 5;
@@ -54,7 +53,7 @@ public class TestBlockJoinValidation ext
private Directory directory;
private IndexReader indexReader;
private IndexSearcher indexSearcher;
- private Filter parentsFilter;
+ private BitDocIdSetFilter parentsFilter;
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -72,7 +71,7 @@ public class TestBlockJoinValidation ext
indexReader = DirectoryReader.open(indexWriter, random().nextBoolean());
indexWriter.close();
indexSearcher = new IndexSearcher(indexReader);
- parentsFilter = new FixedBitSetCachingWrapperFilter(new QueryWrapperFilter(new WildcardQuery(new Term("parent", "*"))));
+ parentsFilter = new BitDocIdSetCachingWrapperFilter(new QueryWrapperFilter(new WildcardQuery(new Term("parent", "*"))));
}
@Test