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/05/09 19:48:24 UTC

[couchdb] branch nouveau-lucene-9.6.0 created (now 6bb4fbd78)

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

rnewson pushed a change to branch nouveau-lucene-9.6.0
in repository https://gitbox.apache.org/repos/asf/couchdb.git


      at 6bb4fbd78 upgrade nouveau to lucene 9.6.0

This branch includes the following new commits:

     new 6bb4fbd78 upgrade nouveau to lucene 9.6.0

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: upgrade nouveau to lucene 9.6.0

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6bb4fbd78eb7d39df2389508f915ae1206d913b3
Author: Robert Newson <rn...@apache.org>
AuthorDate: Tue May 9 20:48:11 2023 +0100

    upgrade nouveau to lucene 9.6.0
---
 nouveau/pom.xml                                    |  2 +-
 .../couchdb/nouveau/lucene9/Lucene9Index.java      | 32 ++++++++++++----------
 src/docs/src/install/unix.rst                      |  2 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/nouveau/pom.xml b/nouveau/pom.xml
index 1c2466761..3a4d478dc 100644
--- a/nouveau/pom.xml
+++ b/nouveau/pom.xml
@@ -24,7 +24,7 @@
     <argLine>-Duser.language=en -Duser.region=US -Duser.timezone=UTC</argLine>
     <dropwizard.version>4.0.0</dropwizard.version>
     <junit5.version>5.8.2</junit5.version>
-    <lucene.version>9.5.0</lucene.version>
+    <lucene.version>9.6.0</lucene.version>
     <maven.compiler.source>11</maven.compiler.source>
     <maven.compiler.target>11</maven.compiler.target>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/nouveau/src/main/java/org/apache/couchdb/nouveau/lucene9/Lucene9Index.java b/nouveau/src/main/java/org/apache/couchdb/nouveau/lucene9/Lucene9Index.java
index 02818f41f..addb801f1 100644
--- a/nouveau/src/main/java/org/apache/couchdb/nouveau/lucene9/Lucene9Index.java
+++ b/nouveau/src/main/java/org/apache/couchdb/nouveau/lucene9/Lucene9Index.java
@@ -56,7 +56,7 @@ import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.document.SortedDocValuesField;
-import org.apache.lucene.document.SortedSetDocValuesField;
+import org.apache.lucene.document.StoredValue;
 import org.apache.lucene.facet.FacetResult;
 import org.apache.lucene.facet.Facets;
 import org.apache.lucene.facet.FacetsCollector;
@@ -248,12 +248,19 @@ public class Lucene9Index extends Index {
                 if (field.name().equals("_id")) {
                     continue;
                 }
-                if (field.numericValue() != null) {
-                    fields.add(new StoredField(field.name(), field.numericValue().doubleValue()));
-                } else if (field.binaryValue() != null) {
-                    fields.add(new StoredField(field.name(), toBytes(field.binaryValue())));
-                } else if (field.stringValue() != null) {
-                    fields.add(new StoredField(field.name(), field.stringValue()));
+                final StoredValue storedValue = field.storedValue();
+                switch (storedValue.getType()) {
+                    case DOUBLE:
+                        fields.add(new StoredField(field.name(), storedValue.getDoubleValue()));
+                        break;
+                    case STRING:
+                        fields.add(new StoredField(field.name(), storedValue.getStringValue()));
+                        break;
+                    case BINARY:
+                        fields.add(new StoredField(field.name(), storedValue.getBinaryValue()));
+                        break;
+                    default:
+                        throw new IllegalArgumentException(storedValue.getType() + " not supported");
                 }
             }
 
@@ -387,18 +394,13 @@ public class Lucene9Index extends Index {
                 result.add(new org.apache.lucene.document.TextField(f.getName(), f.getValue(),
                         f.isStore() ? Store.YES : Store.NO));
             } else if (field instanceof StringField) {
-                // TODO use KeywordField when available.
                 var f = (StringField) field;
-                result.add(new org.apache.lucene.document.StringField(f.getName(), f.getValue(),
+                result.add(new org.apache.lucene.document.KeywordField(f.getName(), f.getValue(),
                         f.isStore() ? Store.YES : Store.NO));
-                result.add(new SortedSetDocValuesField(f.getName(),
-                        new BytesRef(f.getValue())));
             } else if (field instanceof DoubleField) {
                 var f = (DoubleField) field;
-                result.add(new org.apache.lucene.document.DoubleField(f.getName(), f.getValue()));
-                if (f.isStore()) {
-                    result.add(new org.apache.lucene.document.StoredField(f.getName(), f.getValue()));
-                }
+                result.add(new org.apache.lucene.document.DoubleField(f.getName(), f.getValue(),
+                        f.isStore() ? Store.YES : Store.NO));
             } else if (field instanceof StoredField) {
                 var f = (StoredField) field;
                 var val = f.getValue();
diff --git a/src/docs/src/install/unix.rst b/src/docs/src/install/unix.rst
index 3533b424a..8eff02d05 100644
--- a/src/docs/src/install/unix.rst
+++ b/src/docs/src/install/unix.rst
@@ -152,7 +152,7 @@ You should have the following installed:
 * `help2man                     <http://www.gnu.org/s/help2man/>`_
 * `Python (>=3.6) for docs and tests      <http://python.org/>`_
 * `Python Sphinx (>=1.1.3)      <http://pypi.python.org/pypi/Sphinx>`_
-* Java (required for `nouveau`, minimum version 11, recommended version 19)
+* Java (required for `nouveau`, minimum version 11, recommended version 19 or 20)
 * Apache Maven (required for `nouveau`, 3.x)
 
 You will only need libcurl if you plan to run the JavaScript test suite. And