You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/01/06 14:01:38 UTC

[couchdb] 07/07: continue reducing lucene-specific exposure

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch import-nouveau-reorg
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0180f1f4485fd8459cde70d9321cfb238ee67b99
Author: Robert Newson <rn...@apache.org>
AuthorDate: Fri Jan 6 13:49:55 2023 +0000

    continue reducing lucene-specific exposure
---
 java/nouveau/README.md                             |   2 +-
 .../apache/couchdb/nouveau/NouveauApplication.java |   2 -
 .../nouveau/api/document/StoredDocField.java       |  81 ++++++++++++++
 .../nouveau/core/lucene9/BytesRefDeserializer.java |  44 --------
 .../nouveau/core/lucene9/BytesRefSerializer.java   |  40 -------
 .../core/lucene9/DoubleRangeDeserializer.java      |  48 ---------
 .../core/lucene9/DoubleRangeSerializer.java        |  44 --------
 .../nouveau/core/lucene9/FieldDocDeserializer.java |  72 -------------
 .../nouveau/core/lucene9/FieldDocSerializer.java   |  72 -------------
 .../core/lucene9/IndexableFieldDeserializer.java   | 116 --------------------
 .../core/lucene9/IndexableFieldSerializer.java     |  84 ---------------
 .../couchdb/nouveau/core/lucene9/Lucene9Index.java |  42 ++++++++
 .../nouveau/core/lucene9/Lucene9Module.java        |  49 ---------
 .../nouveau/core/lucene9/SupportedType.java        |  82 --------------
 .../core/lucene9/TotalHitsDeserializer.java        |  45 --------
 .../nouveau/api/DocumentUpdateRequestTest.java     |   2 -
 .../couchdb/nouveau/api/SearchRequestTest.java     |   2 -
 .../nouveau/core/lucene9/Lucene9ModuleTest.java    | 119 ---------------------
 18 files changed, 124 insertions(+), 822 deletions(-)

diff --git a/java/nouveau/README.md b/java/nouveau/README.md
index c3a0a7f38..37482ed9b 100644
--- a/java/nouveau/README.md
+++ b/java/nouveau/README.md
@@ -100,7 +100,7 @@ To ease migration nouveau functions can use the 'index' function exactly as it e
 | index("foo", "bar", {"store":true, "facet":true}); | adds a TextField, a StoredField and a SortedSetDocValuesField.
 | index("foo", "bar", "text");                       | adds a TextField.
 | index("foo", "bar", "string");                     | adds a StringField.
-| index("foo", "bar", "stored_string");              | adds a StoredField.
+| index("foo", "bar", "stored");                     | adds a StoredField.
 | index("foo", "bar", "sorted_set_dv");              | adds a SortedSetDocValuesField.
 | index("foo", "bar", "string", true);               | adds a TextField with Store.YES
 
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/NouveauApplication.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/NouveauApplication.java
index 05711ce96..a23e37861 100644
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/NouveauApplication.java
+++ b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/NouveauApplication.java
@@ -17,7 +17,6 @@ import org.apache.couchdb.nouveau.core.IndexManager;
 import org.apache.couchdb.nouveau.core.lucene9.Lucene9AnalyzerFactory;
 import org.apache.couchdb.nouveau.core.lucene9.Lucene9IndexFactory;
 import org.apache.couchdb.nouveau.core.lucene9.Lucene9ParallelSearcherFactory;
-import org.apache.couchdb.nouveau.core.lucene9.Lucene9Module;
 import org.apache.couchdb.nouveau.core.UpdatesOutOfOrderExceptionMapper;
 import org.apache.couchdb.nouveau.health.AnalyzeHealthCheck;
 import org.apache.couchdb.nouveau.health.IndexManagerHealthCheck;
@@ -58,7 +57,6 @@ public class NouveauApplication extends Application<NouveauApplicationConfigurat
         indexFactory.setSearcherFactory(searcherFactory);
 
         final ObjectMapper objectMapper = environment.getObjectMapper();
-        objectMapper.registerModule(new Lucene9Module());
 
         final IndexManager indexManager = new IndexManager();
         indexManager.setMetricRegistry(metricsRegistry);
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/api/document/StoredDocField.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/api/document/StoredDocField.java
new file mode 100644
index 000000000..1de57a04c
--- /dev/null
+++ b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/api/document/StoredDocField.java
@@ -0,0 +1,81 @@
+//
+// Licensed 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.
+
+package org.apache.couchdb.nouveau.api.document;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public final class StoredDocField extends DocField {
+
+    private Object value;
+
+    public StoredDocField() {
+    }
+
+    public StoredDocField(final String name, final String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public StoredDocField(final String name, final byte[] value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public StoredDocField(final String name, final Number value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    @JsonProperty
+    public String getStringValue() {
+        if (value instanceof String) {
+            return (String) value;
+        }
+        return null;
+    }
+
+    public void setStringValue(String stringValue) {
+        this.value = stringValue;
+    }
+
+    @JsonProperty
+    public byte[] getBinaryValue() {
+        if (value instanceof byte[]) {
+            return (byte[]) value;
+        }
+        return null;
+    }
+
+    public void setBinaryValue(byte[] binaryValue) {
+        this.value = binaryValue;
+    }
+
+    @JsonProperty
+    public Number getNumericValue() {
+        if (value instanceof Number) {
+            return (Number) value;
+        }
+        return null;
+    }
+
+    public void setNumericValue(Number numericValue) {
+        this.value = numericValue;
+    }
+
+    @Override
+    public String toString() {
+        return "StoredDocField [name=" + name + ", value=" + value + "]";
+    }
+
+}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefDeserializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefDeserializer.java
deleted file mode 100644
index 5258543b2..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefDeserializer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-public class BytesRefDeserializer extends StdDeserializer<BytesRef> {
-
-
-    public BytesRefDeserializer() {
-        this(null);
-    }
-
-    public BytesRefDeserializer(Class<?> vc) {
-        super(vc);
-    }
-
-    @Override
-    public BytesRef deserialize(final JsonParser parser, final DeserializationContext context)
-    throws IOException, JsonProcessingException {
-        JsonNode node = parser.getCodec().readTree(parser);
-        return new BytesRef(node.binaryValue());
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefSerializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefSerializer.java
deleted file mode 100644
index 2dab1642e..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/BytesRefSerializer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-public class BytesRefSerializer extends StdSerializer<BytesRef> {
-
-    public BytesRefSerializer() {
-        this(null);
-    }
-
-    public BytesRefSerializer(Class<BytesRef> vc) {
-        super(vc);
-    }
-
-    @Override
-    public void serialize(final BytesRef bytesRef, final JsonGenerator gen, final SerializerProvider provider)
-            throws IOException {
-        gen.writeBinary(bytesRef.bytes, bytesRef.offset, bytesRef.length);
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeDeserializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeDeserializer.java
deleted file mode 100644
index 6efe13e1d..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeDeserializer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.facet.range.DoubleRange;
-
-class DoubleRangeDeserializer extends StdDeserializer<DoubleRange> {
-
-    public DoubleRangeDeserializer() {
-        this(null);
-    }
-
-    public DoubleRangeDeserializer(Class<?> vc) {
-        super(vc);
-    }
-
-    @Override
-    public DoubleRange deserialize(final JsonParser parser, final DeserializationContext context)
-    throws IOException, JsonProcessingException {
-        JsonNode node = parser.getCodec().readTree(parser);
-        final String label = node.get("label").asText();
-        final double min = node.get("min").asDouble();
-        final boolean minInc = node.has("inclusive_min") ? node.get("inclusive_min").asBoolean() : true;
-        final double max = node.get("max").asDouble();
-        final boolean maxInc = node.has("inclusive_max") ? node.get("inclusive_max").asBoolean() : true;
-        return new DoubleRange(label, min, minInc, max, maxInc);
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeSerializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeSerializer.java
deleted file mode 100644
index f276f3e82..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/DoubleRangeSerializer.java
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.facet.range.DoubleRange;
-
-class DoubleRangeSerializer extends StdSerializer<DoubleRange> {
-
-    public DoubleRangeSerializer() {
-        this(null);
-    }
-
-    public DoubleRangeSerializer(Class<DoubleRange> vc) {
-        super(vc);
-    }
-
-    @Override
-    public void serialize(final DoubleRange doubleRange, final JsonGenerator gen, final SerializerProvider provider)
-            throws IOException {
-        gen.writeStartObject();
-        gen.writeStringField("label", doubleRange.label);
-        gen.writeNumberField("min", doubleRange.min);
-        gen.writeNumberField("max", doubleRange.max);
-        gen.writeEndObject();
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocDeserializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocDeserializer.java
deleted file mode 100644
index 2e411bcdc..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocDeserializer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-
-import org.apache.couchdb.nouveau.l9x.lucene.search.FieldDoc;
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-public class FieldDocDeserializer extends StdDeserializer<FieldDoc> {
-
-    public FieldDocDeserializer() {
-        this(null);
-    }
-
-    public FieldDocDeserializer(Class<?> vc) {
-        super(vc);
-    }
-
-    @Override
-    public FieldDoc deserialize(final JsonParser parser, final DeserializationContext context)
-            throws IOException, JsonProcessingException {
-        ArrayNode fieldNode = (ArrayNode) parser.getCodec().readTree(parser);
-        final Object[] fields = new Object[fieldNode.size()];
-        for (int i = 0; i < fields.length; i++) {
-            final JsonNode field = fieldNode.get(i);
-            switch (field.get("type").asText()) {
-                case "string":
-                    fields[i] = field.get("value").asText();
-                    break;
-                case "bytes":
-                    fields[i] = new BytesRef(field.get("value").binaryValue());
-                    break;
-                case "float":
-                    fields[i] = field.get("value").floatValue();
-                    break;
-                case "double":
-                    fields[i] = field.get("value").doubleValue();
-                    break;
-                case "int":
-                    fields[i] = field.get("value").intValue();
-                    break;
-                case "long":
-                    fields[i] = field.get("value").longValue();
-                    break;
-                default:
-                    throw new IOException("Unsupported field value: " + field);
-            }
-        }
-        // TODO .doc should be Long.MAX_VALUE if we invert the sort
-        return new FieldDoc(0, Float.NaN, fields);
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocSerializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocSerializer.java
deleted file mode 100644
index 817a717cb..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/FieldDocSerializer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.search.FieldDoc;
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-public class FieldDocSerializer extends StdSerializer<FieldDoc> {
-
-    public FieldDocSerializer() {
-        this(null);
-    }
-
-    public FieldDocSerializer(Class<FieldDoc> vc) {
-        super(vc);
-    }
-
-    @Override
-    public void serialize(final FieldDoc fieldDoc, final JsonGenerator gen, final SerializerProvider provider)
-            throws IOException {
-        // We ignore fieldDoc.score as it will be in the fields array if we're sorting for relevance.
-        // We ignore fieldDoc.doc as _id is always the last field and is unique.
-        gen.writeStartArray();
-        // Preserve type information for correct deserialization of cursor.
-        for (final Object o : fieldDoc.fields) {
-            gen.writeStartObject();
-            if (o instanceof String) {
-                gen.writeStringField("type", "string");
-                gen.writeStringField("value", (String) o);
-            } else if (o instanceof BytesRef) {
-                final BytesRef bytesRef = (BytesRef) o;
-                gen.writeStringField("type", "bytes");
-                gen.writeFieldName("value");
-                gen.writeBinary(bytesRef.bytes, bytesRef.offset, bytesRef.length);
-            } else if (o instanceof Float) {
-                gen.writeStringField("type", "float");
-                gen.writeNumberField("value", (Float) o);
-            } else if (o instanceof Double) {
-                gen.writeStringField("type", "double");
-                gen.writeNumberField("value", (Double) o);
-            } else if (o instanceof Integer) {
-                gen.writeStringField("type", "int");
-                gen.writeNumberField("value", (Integer) o);
-            } else if (o instanceof Long) {
-                gen.writeStringField("type", "long");
-                gen.writeNumberField("value", (Long) o);
-            } else {
-                throw new IOException(o.getClass() + " not supported");
-            }
-            gen.writeEndObject();
-        }
-        gen.writeEndArray();
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldDeserializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldDeserializer.java
deleted file mode 100644
index 25c0e5b28..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldDeserializer.java
+++ /dev/null
@@ -1,116 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.document.BinaryDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.DoubleDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.DoublePoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.FloatDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.Field.Store;
-import org.apache.couchdb.nouveau.l9x.lucene.document.FloatPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.IntPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LatLonDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LatLonPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LongPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedNumericDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedSetDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StoredField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StringField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.TextField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.XYDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.XYPointField;
-import org.apache.couchdb.nouveau.l9x.lucene.index.IndexableField;
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-class IndexableFieldDeserializer extends StdDeserializer<IndexableField> {
-
-    public IndexableFieldDeserializer() {
-        this(null);
-    }
-
-    public IndexableFieldDeserializer(Class<?> vc) {
-        super(vc);
-    }
-
-    @Override
-    public IndexableField deserialize(final JsonParser parser, final DeserializationContext context)
-            throws IOException, JsonProcessingException {
-        JsonNode node = parser.getCodec().readTree(parser);
-
-        final SupportedType type = SupportedType.valueOf(node.get("@type").asText());
-        final String name = node.get("name").asText();
-
-        switch (type) {
-            case binary_dv:
-                return new BinaryDocValuesField(name, bytesRef(node));
-            case double_point:
-                return new DoublePoint(name, node.get("value").doubleValue());
-            case float_dv:
-                return new FloatDocValuesField(name, node.get("value").floatValue());
-            case float_point:
-                return new FloatPoint(name, node.get("value").floatValue());
-            case latlon_dv:
-                return new LatLonDocValuesField(name, node.get("lat").doubleValue(), node.get("lon").doubleValue());
-            case latlon_point:
-                return new LatLonPoint(name, node.get("lat").doubleValue(), node.get("lon").doubleValue());
-            case int_point:
-                return new IntPoint(name, node.get("value").intValue());
-            case long_point:
-                return new LongPoint(name, node.get("value").longValue());
-            case xy_dv:
-                return new XYDocValuesField(name, node.get("x").floatValue(), node.get("y").floatValue());
-            case xy_point:
-                return new XYPointField(name, node.get("x").floatValue(), node.get("y").floatValue());
-            case string:
-                return new StringField(name, node.get("value").asText(),
-                        node.get("stored").asBoolean() ? Store.YES : Store.NO);
-            case text:
-                return new TextField(name, node.get("value").asText(),
-                        node.get("stored").asBoolean() ? Store.YES : Store.NO);
-            case stored_double:
-                return new StoredField(name, node.get("value").asDouble());
-            case stored_string:
-                return new StoredField(name, node.get("value").asText());
-            case stored_binary:
-                return new StoredField(name, bytesRef(node));
-            case sorted_set_dv:
-                return new SortedSetDocValuesField(name, bytesRef(node));
-            case sorted_dv:
-                return new SortedDocValuesField(name, bytesRef(node));
-            case sorted_numeric_dv:
-                return new SortedNumericDocValuesField(name, node.get("value").longValue());
-            case double_dv:
-                return new DoubleDocValuesField(name, node.get("value").asDouble());
-        }
-        throw new IOException(type + " not a valid type of field");
-    }
-
-    private BytesRef bytesRef(final JsonNode node) throws IOException {
-        final JsonNode value = node.get("value");
-        if (node.has("encoded") && node.get("encoded").asBoolean()) {
-            return new BytesRef(value.binaryValue());
-        }
-        return new BytesRef(value.asText());
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldSerializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldSerializer.java
deleted file mode 100644
index f7db3bb64..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/IndexableFieldSerializer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.ser.std.StdSerializer;
-
-import org.apache.couchdb.nouveau.l9x.lucene.geo.GeoEncodingUtils;
-import org.apache.couchdb.nouveau.l9x.lucene.geo.XYEncodingUtils;
-import org.apache.couchdb.nouveau.l9x.lucene.index.IndexableField;
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-
-class IndexableFieldSerializer extends StdSerializer<IndexableField> {
-
-    public IndexableFieldSerializer() {
-        this(null);
-    }
-
-    public IndexableFieldSerializer(Class<IndexableField> vc) {
-        super(vc);
-    }
-
-    @Override
-    public void serialize(final IndexableField field, final JsonGenerator gen, final SerializerProvider provider)
-            throws IOException {
-        final SupportedType type = SupportedType.fromField(field);
-        gen.writeStartObject();
-        gen.writeStringField("@type", type.toString());
-        gen.writeStringField("name", field.name());
-        switch (type) {
-            case double_dv:
-            case double_point:
-            case stored_double:
-                gen.writeNumberField("value", field.numericValue().doubleValue());
-                break;
-            case float_dv:
-            case float_point:
-                gen.writeNumberField("value", field.numericValue().floatValue());
-                break;
-            case int_point:
-                gen.writeNumberField("value", field.numericValue().intValue());
-                break;
-            case latlon_dv:
-            case latlon_point: {
-                final long value = (Long) field.numericValue();
-                gen.writeNumberField("lat", GeoEncodingUtils.decodeLatitude((int) (value >> 32)));
-                gen.writeNumberField("lon", GeoEncodingUtils.decodeLongitude((int) (value & 0xFFFFFFFF)));
-                break;
-            }
-            case long_point:
-            case sorted_numeric_dv:
-                gen.writeNumberField("value", field.numericValue().longValue());
-                break;
-            case binary_dv:
-            case sorted_dv:
-            case sorted_set_dv:
-            case stored_binary: {
-                final BytesRef bytesRef = field.binaryValue();
-                gen.writeFieldName("value");
-                gen.writeBinary(bytesRef.bytes, bytesRef.offset, bytesRef.length);
-                gen.writeBooleanField("encoded", true);
-                break;
-            }
-            case stored_string:
-                gen.writeStringField("value", field.stringValue());
-                break;
-            case string:
-            case text:
-                gen.writeStringField("value", field.stringValue());
-                gen.writeBooleanField("stored", field.fieldType().stored());
-                break;
-            case xy_dv:
-            case xy_point: {
-                final BytesRef bytesRef = field.binaryValue();
-                gen.writeNumberField("x", XYEncodingUtils.decode(bytesRef.bytes, 0));
-                gen.writeNumberField("y", XYEncodingUtils.decode(bytesRef.bytes, Integer.BYTES));
-                break;
-            }
-        }
-        gen.writeEndObject();
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Index.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Index.java
index 740c83cfe..e49ff98d9 100644
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Index.java
+++ b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Index.java
@@ -16,6 +16,7 @@ package org.apache.couchdb.nouveau.core.lucene9;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -34,6 +35,7 @@ import org.apache.couchdb.nouveau.api.SearchRequest;
 import org.apache.couchdb.nouveau.api.SearchResults;
 import org.apache.couchdb.nouveau.api.document.DocField;
 import org.apache.couchdb.nouveau.api.document.DoublePointDocField;
+import org.apache.couchdb.nouveau.api.document.StoredDocField;
 import org.apache.couchdb.nouveau.api.document.StringDocField;
 import org.apache.couchdb.nouveau.api.document.TextDocField;
 import org.apache.couchdb.nouveau.core.Index;
@@ -42,7 +44,9 @@ import org.apache.couchdb.nouveau.core.QueryParserException;
 import org.apache.couchdb.nouveau.l9x.lucene.analysis.Analyzer;
 import org.apache.couchdb.nouveau.l9x.lucene.document.Document;
 import org.apache.couchdb.nouveau.l9x.lucene.document.DoublePoint;
+import org.apache.couchdb.nouveau.l9x.lucene.document.Field;
 import org.apache.couchdb.nouveau.l9x.lucene.document.SortedDocValuesField;
+import org.apache.couchdb.nouveau.l9x.lucene.document.StoredField;
 import org.apache.couchdb.nouveau.l9x.lucene.document.StringField;
 import org.apache.couchdb.nouveau.l9x.lucene.document.TextField;
 import org.apache.couchdb.nouveau.l9x.lucene.document.Field.Store;
@@ -336,6 +340,30 @@ class Lucene9Index extends Index {
             final DoublePointDocField field = (DoublePointDocField) docField;
             return new DoublePoint(field.getName(), field.getValue());
         }
+        if (docField instanceof StoredDocField) {
+            final StoredDocField field = (StoredDocField) docField;
+            if (field.getStringValue() != null) {
+                return new StoredField(field.getName(), field.getStringValue());
+            }
+            if (field.getBinaryValue() != null) {
+                return new StoredField(field.getName(), field.getBinaryValue());
+            }
+            if (field.getNumericValue() != null) {
+                final Number value = (Number) field.getNumericValue();
+                if (value instanceof Long) {
+                    return new StoredField(field.getName(), (long) value);
+                }
+                if (value instanceof Integer) {
+                    return new StoredField(field.getName(), (int) value);
+                }
+                if (value instanceof Double) {
+                    return new StoredField(field.getName(), (double) value);
+                }
+                if (value instanceof Float) {
+                    return new StoredField(field.getName(), (float) value);
+                }
+            }
+        }
         throw new IllegalArgumentException(docField.getClass() + " not valid");
     }
 
@@ -352,6 +380,20 @@ class Lucene9Index extends Index {
             final DoublePoint field = (DoublePoint) indexableField;
             return new DoublePointDocField(field.name(), (Double) field.numericValue());
         }
+        if (indexableField instanceof StoredField) {
+            final StoredField field = (StoredField) indexableField;
+            if (field.stringValue() != null) {
+                return new StoredDocField(field.name(), field.stringValue());
+            }
+            if (field.binaryValue() != null) {
+                final BytesRef bytesRef = field.binaryValue();
+                final byte[] bytes = Arrays.copyOfRange(bytesRef.bytes, bytesRef.offset, bytesRef.offset + bytesRef.length);
+                return new StoredDocField(field.name(), bytes);
+            }
+            if (field.numericValue() != null) {
+                return new StoredDocField(field.name(), field.numericValue());
+            }
+        }
         throw new IllegalArgumentException(indexableField.getClass() + " not valid");
     }
 
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Module.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Module.java
deleted file mode 100644
index af4bd5d68..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9Module.java
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-
-import org.apache.couchdb.nouveau.l9x.lucene.facet.range.DoubleRange;
-import org.apache.couchdb.nouveau.l9x.lucene.index.IndexableField;
-import org.apache.couchdb.nouveau.l9x.lucene.search.FieldDoc;
-import org.apache.couchdb.nouveau.l9x.lucene.search.TotalHits;
-
-public class Lucene9Module extends SimpleModule {
-
-    public Lucene9Module() {
-        super("lucene", Version.unknownVersion());
-
-        // IndexableField
-        addSerializer(IndexableField.class, new IndexableFieldSerializer());
-        addDeserializer(IndexableField.class, new IndexableFieldDeserializer());
-
-        // DoubleRange
-        addSerializer(DoubleRange.class, new DoubleRangeSerializer());
-        addDeserializer(DoubleRange.class, new DoubleRangeDeserializer());
-
-        // FieldDoc
-        addSerializer(FieldDoc.class, new FieldDocSerializer());
-        addDeserializer(FieldDoc.class, new FieldDocDeserializer());
-
-        // TotalHits
-        addDeserializer(TotalHits.class, new TotalHitsDeserializer());
-
-        // BytesRef - disabled until I'm sure I need it.
-        // addSerializer(BytesRef.class, new BytesRefSerializer());
-        // addDeserializer(BytesRef.class, new BytesRefDeserializer());
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/SupportedType.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/SupportedType.java
deleted file mode 100644
index 6a9465bd4..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/SupportedType.java
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import org.apache.couchdb.nouveau.l9x.lucene.document.BinaryDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.DoubleDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.DoublePoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.FloatDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.FloatPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.IntPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LatLonDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LatLonPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.LongPoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedNumericDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.SortedSetDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StoredField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StringField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.TextField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.XYDocValuesField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.XYPointField;
-import org.apache.couchdb.nouveau.l9x.lucene.index.IndexableField;
-
-enum SupportedType {
-
-    binary_dv(BinaryDocValuesField.class),
-    double_dv(DoubleDocValuesField.class),
-    double_point(DoublePoint.class),
-    float_dv(FloatDocValuesField.class),
-    float_point(FloatPoint.class),
-    int_point(IntPoint.class),
-    latlon_dv(LatLonDocValuesField.class),
-    latlon_point(LatLonPoint.class),
-    long_point(LongPoint.class),
-    sorted_dv(SortedDocValuesField.class),
-    sorted_numeric_dv(SortedNumericDocValuesField.class),
-    sorted_set_dv(SortedSetDocValuesField.class),
-    stored_binary(StoredField.class),
-    stored_double(StoredField.class),
-    stored_string(StoredField.class),
-    string(StringField.class),
-    text(TextField.class),
-    xy_dv(XYDocValuesField.class),
-    xy_point(XYPointField.class);
-
-    private final Class<? extends IndexableField> clazz;
-
-    private SupportedType(final Class<? extends IndexableField> clazz) {
-        this.clazz = clazz;
-    }
-
-    public static SupportedType fromField(final IndexableField field) {
-        if (field instanceof StoredField) {
-            final StoredField storedField = (StoredField) field;
-            if (storedField.numericValue() != null) {
-                return stored_double;
-            } else if (storedField.stringValue() != null) {
-                return stored_string;
-            } else if (storedField.binaryValue() != null) {
-                return stored_binary;
-            }
-        }
-        for (final SupportedType t : SupportedType.values()) {
-            if (t.clazz.isAssignableFrom(field.getClass())) {
-               return t;
-           }
-        }
-        throw new IllegalArgumentException(field + " is not a supported type");
-    }
-
-}
diff --git a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/TotalHitsDeserializer.java b/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/TotalHitsDeserializer.java
deleted file mode 100644
index 2e3fa5d1a..000000000
--- a/java/nouveau/server/src/main/java/org/apache/couchdb/nouveau/core/lucene9/TotalHitsDeserializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import java.io.IOException;
-
-import org.apache.couchdb.nouveau.l9x.lucene.search.TotalHits;
-import org.apache.couchdb.nouveau.l9x.lucene.search.TotalHits.Relation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-
-public class TotalHitsDeserializer extends StdDeserializer<TotalHits> {
-
-    public TotalHitsDeserializer() {
-        this(null);
-    }
-
-    public TotalHitsDeserializer(Class<?> vc) {
-        super(vc);
-    }
-
-    @Override
-    public TotalHits deserialize(final JsonParser parser, final DeserializationContext context)
-            throws IOException, JsonProcessingException {
-        JsonNode node = parser.getCodec().readTree(parser);
-        final long value = node.get("value").asLong();
-        final Relation relation = Relation.valueOf(node.get("relation").asText());
-        return new TotalHits(value, relation);
-    }
-
-}
diff --git a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/DocumentUpdateRequestTest.java b/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/DocumentUpdateRequestTest.java
index d146ad4fc..6fe240fc2 100644
--- a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/DocumentUpdateRequestTest.java
+++ b/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/DocumentUpdateRequestTest.java
@@ -25,7 +25,6 @@ import org.apache.couchdb.nouveau.api.document.DocField;
 import org.apache.couchdb.nouveau.api.document.DoublePointDocField;
 import org.apache.couchdb.nouveau.api.document.StringDocField;
 import org.apache.couchdb.nouveau.api.document.TextDocField;
-import org.apache.couchdb.nouveau.core.lucene9.Lucene9Module;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
@@ -36,7 +35,6 @@ public class DocumentUpdateRequestTest {
     @BeforeAll
     public static void setupMapper() {
         mapper = new ObjectMapper();
-        mapper.registerModule(new Lucene9Module());
     }
 
     @Test
diff --git a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/SearchRequestTest.java b/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/SearchRequestTest.java
index 6cd4dfb41..e6986ee8a 100644
--- a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/SearchRequestTest.java
+++ b/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/api/SearchRequestTest.java
@@ -6,7 +6,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.couchdb.nouveau.core.lucene9.Lucene9Module;
 import org.apache.couchdb.nouveau.l9x.lucene.facet.range.DoubleRange;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -20,7 +19,6 @@ public class SearchRequestTest {
     @BeforeAll
     public static void setupMapper() {
         mapper = new ObjectMapper();
-        mapper.registerModule(new Lucene9Module());
     }
 
     @Test
diff --git a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9ModuleTest.java b/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9ModuleTest.java
deleted file mode 100644
index 2c8da841d..000000000
--- a/java/nouveau/server/src/test/java/org/apache/couchdb/nouveau/core/lucene9/Lucene9ModuleTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// Licensed 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.
-
-package org.apache.couchdb.nouveau.core.lucene9;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import org.apache.couchdb.nouveau.core.lucene9.Lucene9Module;
-import org.apache.couchdb.nouveau.l9x.lucene.document.DoublePoint;
-import org.apache.couchdb.nouveau.l9x.lucene.document.Field.Store;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StoredField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.StringField;
-import org.apache.couchdb.nouveau.l9x.lucene.document.TextField;
-import org.apache.couchdb.nouveau.l9x.lucene.search.FieldDoc;
-import org.apache.couchdb.nouveau.l9x.lucene.util.BytesRef;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-public class Lucene9ModuleTest {
-
-    private static ObjectMapper mapper;
-
-    @BeforeAll
-    public static void setupMapper() {
-        mapper = new ObjectMapper();
-        mapper.registerModule(new Lucene9Module());
-    }
-
-    @Test
-    public void testSerializeStringFieldStoreYES() throws Exception {
-        final String expected = "{\"@type\":\"string\",\"name\":\"foo\",\"value\":\"bar\",\"stored\":true}";
-        final String actual = mapper.writeValueAsString(new StringField("foo", "bar", Store.YES));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeStringFieldStoreNO() throws Exception {
-        final String expected = "{\"@type\":\"string\",\"name\":\"foo\",\"value\":\"bar\",\"stored\":false}";
-        final String actual = mapper.writeValueAsString(new StringField("foo", "bar", Store.NO));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeTextFieldStoreYES() throws Exception {
-        final String expected = "{\"@type\":\"text\",\"name\":\"foo\",\"value\":\"bar\",\"stored\":true}";
-        final String actual = mapper.writeValueAsString(new TextField("foo", "bar", Store.YES));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeTextFieldStoreNO() throws Exception {
-        final String expected = "{\"@type\":\"text\",\"name\":\"foo\",\"value\":\"bar\",\"stored\":false}";
-        final String actual = mapper.writeValueAsString(new TextField("foo", "bar", Store.NO));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeDoublePoint() throws Exception {
-        final String expected = "{\"@type\":\"double_point\",\"name\":\"foo\",\"value\":12.5}";
-        final String actual = mapper.writeValueAsString(new DoublePoint("foo", 12.5));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeStoredFieldString() throws Exception {
-        final String expected = "{\"@type\":\"stored_string\",\"name\":\"foo\",\"value\":\"bar\"}";
-        final String actual = mapper.writeValueAsString(new StoredField("foo", "bar"));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeStoredFieldDouble() throws Exception {
-        final String expected = "{\"@type\":\"stored_double\",\"name\":\"foo\",\"value\":12.5}";
-        final String actual = mapper.writeValueAsString(new StoredField("foo", 12.5));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeStoredFieldBinary() throws Exception {
-        final String expected = "{\"@type\":\"stored_binary\",\"name\":\"foo\",\"value\":\"YmFy\",\"encoded\":true}";
-        final String actual = mapper.writeValueAsString(new StoredField("foo", new BytesRef("bar")));
-        assertEquals(expected, actual);
-    }
-
-    @Test
-    public void testSerializeFieldDoc() throws Exception {
-        final FieldDoc fieldDoc = new FieldDoc(1, 2.0f, new Object[] {
-                Float.valueOf(1),
-                Double.valueOf(2),
-                Integer.valueOf(3),
-                Long.valueOf(4),
-                "foo",
-                new BytesRef("bar") });
-
-        final String expected = "[{\"type\":\"float\",\"value\":1.0},{\"type\":\"double\",\"value\":2.0},{\"type\":\"int\",\"value\":3},{\"type\":\"long\",\"value\":4},{\"type\":\"string\",\"value\":\"foo\"},{\"type\":\"bytes\",\"value\":\"YmFy\"}]";
-        final String actual = mapper.writeValueAsString(fieldDoc);
-        assertEquals(expected, actual);
-
-        final FieldDoc fieldDoc2 = mapper.readValue(expected, FieldDoc.class);
-
-        for (int i = 0; i < fieldDoc.fields.length; i++) {
-            assertThat(fieldDoc.fields[i].getClass()).isEqualTo(fieldDoc2.fields[i].getClass());
-        }
-    }
-
-}