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/04/24 13:21:21 UTC

[couchdb] branch nouveau-remove-facet-field created (now 3c90100de)

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

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


      at 3c90100de remove unused facet property

This branch includes the following new commits:

     new 3c90100de remove unused facet property

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: remove unused facet property

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

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

commit 3c90100dec7e9962afeade4382c94ce4b885e5d6
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Apr 24 14:17:05 2023 +0100

    remove unused facet property
    
    (all fields are indexed for faceting)
---
 nouveau/README.md                                           |  6 +++---
 .../java/org/apache/couchdb/nouveau/api/DoubleField.java    | 13 ++-----------
 .../java/org/apache/couchdb/nouveau/api/StringField.java    | 13 ++-----------
 .../apache/couchdb/nouveau/lucene9/Lucene9IndexTest.java    | 12 ++++++------
 4 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/nouveau/README.md b/nouveau/README.md
index 86b1914a7..56c0a02db 100644
--- a/nouveau/README.md
+++ b/nouveau/README.md
@@ -102,9 +102,9 @@ curl 'foo:bar@localhost:15984/foo/_design/foo/_nouveau/bar?q=*:*&limit=1&ranges=
 
 | Arguments                                                       | Effect
 | :-------------------------------------------------------------- | :-----
-| index("text", "foo", "bar", {"store": true});                  | analyzes value for full-text searching, optionally stores the value
-| index("string", "foo", "bar", {"store": true, "facet": true}); | indexes value as single token, optionally stores value and/or adds facet
-| index("double", "foo", 12.0, {"store": true, "facet": true});  | indexes value, optionally stores value and/or adds facet
+| index("text", "foo", "bar", {"store": true});                   | analyzes value for full-text searching, optionally stores the value
+| index("string", "foo", "bar", {"store": true});                 | indexes value as single token, optionally stores value
+| index("double", "foo", 12.0, {"store": true});                  | indexes value, optionally stores value
 | index("stored", "foo", "bar");                                  | stores a number, returned with hits
 | index("stored", "foo", 12.0);                                   | stores a string, returned with hits
 
diff --git a/nouveau/src/main/java/org/apache/couchdb/nouveau/api/DoubleField.java b/nouveau/src/main/java/org/apache/couchdb/nouveau/api/DoubleField.java
index 57ff4c858..1f3639191 100644
--- a/nouveau/src/main/java/org/apache/couchdb/nouveau/api/DoubleField.java
+++ b/nouveau/src/main/java/org/apache/couchdb/nouveau/api/DoubleField.java
@@ -17,7 +17,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.PropertyNamingStrategies;
 import com.fasterxml.jackson.databind.annotation.JsonNaming;
 
-
 import jakarta.validation.constraints.NotNull;
 
 @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@@ -28,14 +27,11 @@ public class DoubleField extends Field {
 
     private final boolean store;
 
-    private final boolean facet;
-
     public DoubleField(@JsonProperty("name") final String name, @JsonProperty("value") final Double value,
-            @JsonProperty("store") final boolean store, @JsonProperty("facet") final boolean facet) {
+            @JsonProperty("store") final boolean store) {
         super(name);
         this.value = value;
         this.store = store;
-        this.facet = facet;
     }
 
     @JsonProperty
@@ -48,14 +44,9 @@ public class DoubleField extends Field {
         return store;
     }
 
-    @JsonProperty
-    public boolean isFacet() {
-        return facet;
-    }
-
     @Override
     public String toString() {
-        return "DoubleField [name=" + name + ", value=" + value + ", store=" + store + ", facet=" + facet + "]";
+        return "DoubleField [name=" + name + ", value=" + value + ", store=" + store + "]";
     }
 
 }
\ No newline at end of file
diff --git a/nouveau/src/main/java/org/apache/couchdb/nouveau/api/StringField.java b/nouveau/src/main/java/org/apache/couchdb/nouveau/api/StringField.java
index d32671ae1..cfb9264d3 100644
--- a/nouveau/src/main/java/org/apache/couchdb/nouveau/api/StringField.java
+++ b/nouveau/src/main/java/org/apache/couchdb/nouveau/api/StringField.java
@@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.PropertyNamingStrategies;
 import com.fasterxml.jackson.databind.annotation.JsonNaming;
 
-
 import jakarta.validation.constraints.NotNull;
 
 @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@@ -30,14 +29,11 @@ public final class StringField extends Field {
 
     private final boolean store;
 
-    private final boolean facet;
-
     public StringField(@JsonProperty("name") final String name, @JsonProperty("value") final String value,
-            @JsonProperty("store") final boolean store, @JsonProperty("facet") final boolean facet) {
+            @JsonProperty("store") final boolean store) {
         super(name);
         this.value = Objects.requireNonNull(value);
         this.store = store;
-        this.facet = facet;
     }
 
     @JsonProperty
@@ -50,14 +46,9 @@ public final class StringField extends Field {
         return store;
     }
 
-    @JsonProperty
-    public boolean isFacet() {
-        return facet;
-    }
-
     @Override
     public String toString() {
-        return "StringField [name=" + name + ", value=" + value + ", store=" + store + ", facet=" + facet + "]";
+        return "StringField [name=" + name + ", value=" + value + ", store=" + store + "]";
     }
 
 }
\ No newline at end of file
diff --git a/nouveau/src/test/java/org/apache/couchdb/nouveau/lucene9/Lucene9IndexTest.java b/nouveau/src/test/java/org/apache/couchdb/nouveau/lucene9/Lucene9IndexTest.java
index 1b28a01f4..f6d47e61a 100644
--- a/nouveau/src/test/java/org/apache/couchdb/nouveau/lucene9/Lucene9IndexTest.java
+++ b/nouveau/src/test/java/org/apache/couchdb/nouveau/lucene9/Lucene9IndexTest.java
@@ -72,7 +72,7 @@ public class Lucene9IndexTest {
         try {
             final int count = 100;
             for (int i = 1; i <= count; i++) {
-                final Collection<Field> fields = List.of(new StringField("foo", "bar", false, false));
+                final Collection<Field> fields = List.of(new StringField("foo", "bar", false));
                 final DocumentUpdateRequest request = new DocumentUpdateRequest(i, null, fields);
                 index.update("doc" + i, request);
             }
@@ -91,7 +91,7 @@ public class Lucene9IndexTest {
         try {
             final int count = 100;
             for (int i = 1; i <= count; i++) {
-                final Collection<Field> fields = List.of(new StringField("foo", "bar", false, false));
+                final Collection<Field> fields = List.of(new StringField("foo", "bar", false));
                 final DocumentUpdateRequest request = new DocumentUpdateRequest(i, null, fields);
                 index.update("doc" + i, request);
             }
@@ -111,7 +111,7 @@ public class Lucene9IndexTest {
         try {
             final int count = 100;
             for (int i = 1; i <= count; i++) {
-                final Collection<Field> fields = List.of(new StringField("bar", "baz", false, true));
+                final Collection<Field> fields = List.of(new StringField("bar", "baz", false));
                 final DocumentUpdateRequest request = new DocumentUpdateRequest(i, null, fields);
                 index.update("doc" + i, request);
             }
@@ -131,7 +131,7 @@ public class Lucene9IndexTest {
         try {
             final int count = 100;
             for (int i = 1; i <= count; i++) {
-                final Collection<Field> fields = List.of(new DoubleField("bar", (double) i, false, true));
+                final Collection<Field> fields = List.of(new DoubleField("bar", (double) i, false));
                 final DocumentUpdateRequest request = new DocumentUpdateRequest(i, null, fields);
                 index.update("doc" + i, request);
             }
@@ -174,7 +174,7 @@ public class Lucene9IndexTest {
             assertThat(info.getNumDocs()).isEqualTo(0);
             assertThat(info.getUpdateSeq()).isEqualTo(0);
 
-            final Collection<Field> fields = List.of(new DoubleField("bar", 12.0, false, true));
+            final Collection<Field> fields = List.of(new DoubleField("bar", 12.0, false));
             index.update("foo", new DocumentUpdateRequest(2, null, fields));
             index.commit();
 
@@ -191,7 +191,7 @@ public class Lucene9IndexTest {
     public void testDelete(@TempDir Path path) throws IOException {
         Index index = setup(path);
         try {
-            final Collection<Field> fields = List.of(new DoubleField("bar", 12.0, false, true));
+            final Collection<Field> fields = List.of(new DoubleField("bar", 12.0, false));
             index.update("foo", new DocumentUpdateRequest(2, null, fields));
             index.commit();