Skip to content

Apache Lucene open-source search software

lucene41 -> disk

Robert Muir71e6ea1e248b
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesConsumer.java b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesConsumer.java
similarity index 91%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesConsumer.java
rename to lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesConsumer.java
index bd6ebc5158f..6abf13e0439 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesConsumer.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesConsumer.java
@@ -1,4 +1,4 @@
-package org.apache.lucene.codecs.lucene41;
+package org.apache.lucene.codecs.diskdv;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -32,19 +32,19 @@ import org.apache.lucene.util.packed.PackedInts;
import org.apache.lucene.util.packed.PackedInts.FormatAndBits;
// nocommit fix exception handling (make sure tests find problems first)
-class Lucene41SimpleDocValuesConsumer extends SimpleDVConsumer {
+class DiskDocValuesConsumer extends SimpleDVConsumer {
final IndexOutput data, meta;
final int maxDoc;
- Lucene41SimpleDocValuesConsumer(SegmentWriteState state) throws IOException {
+ DiskDocValuesConsumer(SegmentWriteState state) throws IOException {
String dataName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, "dvd");
data = state.directory.createOutput(dataName, state.context);
- CodecUtil.writeHeader(data, Lucene41SimpleDocValuesFormat.DATA_CODEC,
- Lucene41SimpleDocValuesFormat.VERSION_CURRENT);
+ CodecUtil.writeHeader(data, DiskDocValuesFormat.DATA_CODEC,
+ DiskDocValuesFormat.VERSION_CURRENT);
String metaName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, "dvm");
meta = state.directory.createOutput(metaName, state.context);
- CodecUtil.writeHeader(meta, Lucene41SimpleDocValuesFormat.METADATA_CODEC,
- Lucene41SimpleDocValuesFormat.VERSION_CURRENT);
+ CodecUtil.writeHeader(meta, DiskDocValuesFormat.METADATA_CODEC,
+ DiskDocValuesFormat.VERSION_CURRENT);
maxDoc = state.segmentInfo.getDocCount();
}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesFormat.java
similarity index 80%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesFormat.java
rename to lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesFormat.java
index 5dd3f987a30..50f7ce226bf 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesFormat.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesFormat.java
@@ -1,4 +1,4 @@
-package org.apache.lucene.codecs.lucene41;
+package org.apache.lucene.codecs.diskdv;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -37,24 +37,24 @@ import org.apache.lucene.index.SegmentWriteState;
* fixedLength SortedField = BINARY + NUMERIC (ords)
* variableLength SortedField = BINARY + NUMERIC (addresses) + NUMERIC (ords)
*/
-public class Lucene41SimpleDocValuesFormat extends SimpleDocValuesFormat {
+public class DiskDocValuesFormat extends SimpleDocValuesFormat {
- public Lucene41SimpleDocValuesFormat() {
- super("Lucene41");
+ public DiskDocValuesFormat() {
+ super("Disk");
}
@Override
public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
- return new Lucene41SimpleDocValuesConsumer(state);
+ return new DiskDocValuesConsumer(state);
}
@Override
public SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
- return new Lucene41SimpleDocValuesProducer(state);
+ return new DiskDocValuesProducer(state);
}
- static final String DATA_CODEC = "Lucene41DocValuesData";
- static final String METADATA_CODEC = "Lucene41DocValuesMetadata";
+ static final String DATA_CODEC = "DiskDocValuesData";
+ static final String METADATA_CODEC = "DiskDocValuesMetadata";
static final int VERSION_START = 0;
static final int VERSION_CURRENT = VERSION_START;
}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesProducer.java b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
similarity index 92%
rename from lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesProducer.java
rename to lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
index 9caeb08a9dc..1a1bb4833dd 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41SimpleDocValuesProducer.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/DiskDocValuesProducer.java
@@ -1,4 +1,4 @@
-package org.apache.lucene.codecs.lucene41;
+package org.apache.lucene.codecs.diskdv;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -37,21 +37,21 @@ import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.packed.PackedInts;
-class Lucene41SimpleDocValuesProducer extends SimpleDVProducer {
+class DiskDocValuesProducer extends SimpleDVProducer {
private final Map<Integer,NumericEntry> numerics;
private final Map<Integer,NumericEntry> ords;
private final Map<Integer,BinaryEntry> binaries;
private final IndexInput data;
- Lucene41SimpleDocValuesProducer(SegmentReadState state) throws IOException {
+ DiskDocValuesProducer(SegmentReadState state) throws IOException {
String metaName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, "dvm");
// read in the entries from the metadata file.
IndexInput in = state.directory.openInput(metaName, state.context);
boolean success = false;
try {
- CodecUtil.checkHeader(in, Lucene41SimpleDocValuesFormat.METADATA_CODEC,
- Lucene41SimpleDocValuesFormat.VERSION_START,
- Lucene41SimpleDocValuesFormat.VERSION_START);
+ CodecUtil.checkHeader(in, DiskDocValuesFormat.METADATA_CODEC,
+ DiskDocValuesFormat.VERSION_START,
+ DiskDocValuesFormat.VERSION_START);
numerics = new HashMap<Integer,NumericEntry>();
ords = new HashMap<Integer,NumericEntry>();
binaries = new HashMap<Integer,BinaryEntry>();
@@ -67,9 +67,9 @@ class Lucene41SimpleDocValuesProducer extends SimpleDVProducer {
String dataName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, "dvd");
data = state.directory.openInput(dataName, state.context);
- CodecUtil.checkHeader(data, Lucene41SimpleDocValuesFormat.DATA_CODEC,
- Lucene41SimpleDocValuesFormat.VERSION_START,
- Lucene41SimpleDocValuesFormat.VERSION_START);
+ CodecUtil.checkHeader(data, DiskDocValuesFormat.DATA_CODEC,
+ DiskDocValuesFormat.VERSION_START,
+ DiskDocValuesFormat.VERSION_START);
}
private void readFields(IndexInput meta, FieldInfos infos) throws IOException {
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/package.html b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/package.html
new file mode 100644
index 00000000000..54454c0bdfa
--- /dev/null
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/diskdv/package.html
@@ -0,0 +1,25 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+DocValuesFormat that accesses values directly from disk.
+</body>
+</html>
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesFormat.java
index c33483869c6..74ae8bd96cc 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesFormat.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryDocValuesFormat.java
@@ -36,7 +36,7 @@ import org.apache.lucene.util.packed.PackedInts;
/** Indexes doc values to disk and loads them in RAM at
* search time. */
-// nocommit: nuke this wrapper and just make a nice impl (e.g. FST for sortedbytes)
+// nocommit: nuke this wrapper and just make a nice impl for 4.1 (e.g. FST for sortedbytes)
public class MemoryDocValuesFormat extends SimpleDocValuesFormat {
public MemoryDocValuesFormat() {
diff --git a/lucene/codecs/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat b/lucene/codecs/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
index 858408a7361..2b9372d84c5 100644
--- a/lucene/codecs/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
+++ b/lucene/codecs/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
@@ -13,5 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+org.apache.lucene.codecs.diskdv.DiskDocValuesFormat
org.apache.lucene.codecs.memory.MemoryDocValuesFormat
org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41Codec.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41Codec.java
index aff6a6fe785..7ed58d62aa7 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41Codec.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41Codec.java
@@ -144,7 +144,7 @@ public class Lucene41Codec extends Codec {
private final PostingsFormat defaultFormat = PostingsFormat.forName("Lucene41");
// nocommit
- private final SimpleDocValuesFormat defaultDVFormat = SimpleDocValuesFormat.forName("Lucene41");
+ private final SimpleDocValuesFormat defaultDVFormat = SimpleDocValuesFormat.forName("Disk");
private final SimpleNormsFormat simpleNormsFormat = new Lucene41SimpleNormsFormat();
diff --git a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
index fae7ae8fd83..82a40cfcf80 100644
--- a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
+++ b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.SimpleDocValuesFormat
@@ -13,6 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.lucene.codecs.lucene41.Lucene41SimpleDocValuesFormat
-org.apache.lucene.codecs.memory.MemoryDocValuesFormat
-org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat
+#nocommit org.apache.lucene.codecs.lucene41.Lucene41SimpleDocValuesFormat
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestComplexExplanations.java b/lucene/core/src/test/org/apache/lucene/search/TestComplexExplanations.java
index 37c9e650857..5f66d39a53a 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestComplexExplanations.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestComplexExplanations.java
@@ -27,6 +27,8 @@ import org.apache.lucene.search.spans.*;
* on the assumption that if the explanations work out right for them,
* they should work for anything.
*/
+// nocommit: fix this slow-wrapper sortedDV fail:
+// ant test -Dtestcase=TestComplexExplanations -Dtests.method=testMPQ7 -Dtests.seed=8FB070EE0C4130E9 -Dtests.slow=true -Dtests.locale=it_CH -Dtests.timezone=America/Grand_Turk -Dtests.file.encoding=UTF-8
public class TestComplexExplanations extends TestExplanations {
/**
diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java b/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java
index d46f8efc643..8c083fd77f9 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java
@@ -32,9 +32,9 @@ import org.apache.lucene.codecs.SimpleDocValuesFormat;
import org.apache.lucene.codecs.asserting.AssertingPostingsFormat;
import org.apache.lucene.codecs.lucene41.Lucene41Codec;
import org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat;
-import org.apache.lucene.codecs.lucene41.Lucene41SimpleDocValuesFormat;
import org.apache.lucene.codecs.lucene41ords.Lucene41WithOrds;
import org.apache.lucene.codecs.bloom.TestBloomFilteredLucene41Postings;
+import org.apache.lucene.codecs.diskdv.DiskDocValuesFormat;
import org.apache.lucene.codecs.memory.DirectPostingsFormat;
import org.apache.lucene.codecs.memory.MemoryDocValuesFormat;
import org.apache.lucene.codecs.memory.MemoryPostingsFormat;
@@ -142,7 +142,7 @@ public class RandomCodec extends Lucene41Codec {
new MemoryPostingsFormat(false, random.nextFloat()));
addDocValues(avoidCodecs,
- new Lucene41SimpleDocValuesFormat(),
+ new DiskDocValuesFormat(),
new SimpleTextSimpleDocValuesFormat(),
new MemoryDocValuesFormat());