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/11 05:34:41 UTC

[couchdb] branch dreyfus-default-field created (now 4c80583e3)

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

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


      at 4c80583e3 fix dreyfus after 'Improve nouveau mango integration'

This branch includes the following new commits:

     new 4c80583e3 fix dreyfus after 'Improve nouveau mango integration'

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: fix dreyfus after 'Improve nouveau mango integration'

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

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

commit 4c80583e3de6081d664db91fd85c2bed741880dc
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu May 11 06:33:46 2023 +0100

    fix dreyfus after 'Improve nouveau mango integration'
    
    dreyfus/clouseau needs "string" type when indexing, so
    make a separate add_default_field_nouveau function
---
 src/mango/src/mango_native_proc.erl | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl
index 7982fc787..41529a05d 100644
--- a/src/mango/src/mango_native_proc.erl
+++ b/src/mango/src/mango_native_proc.erl
@@ -254,14 +254,23 @@ add_default_text_field(Fields) ->
 add_default_text_field([], Acc) ->
     Acc;
 add_default_text_field([{_Name, <<"string">>, Value} | Rest], Acc) ->
-    NewAcc = [{<<"$default">>, <<"text">>, Value} | Acc],
-    add_default_text_field(Rest, NewAcc);
-add_default_text_field([{_Name, <<"text">>, Value} | Rest], Acc) ->
-    NewAcc = [{<<"$default">>, <<"text">>, Value} | Acc],
+    NewAcc = [{<<"$default">>, <<"string">>, Value} | Acc],
     add_default_text_field(Rest, NewAcc);
 add_default_text_field([_ | Rest], Acc) ->
     add_default_text_field(Rest, Acc).
 
+add_default_text_field_nouveau(Fields) ->
+    DefaultFields = add_default_text_field_nouveau(Fields, []),
+    DefaultFields ++ Fields.
+
+add_default_text_field_nouveau([], Acc) ->
+    Acc;
+add_default_text_field_nouveau([{_Name, <<"string">>, Value} | Rest], Acc) ->
+    NewAcc = [{<<"$default">>, <<"text">>, Value} | Acc],
+    add_default_text_field_nouveau(Rest, NewAcc);
+add_default_text_field_nouveau([_ | Rest], Acc) ->
+    add_default_text_field_nouveau(Rest, Acc).
+
 %% index of all field names
 get_field_names(Fields) ->
     FieldNameSet = lists:foldl(
@@ -345,7 +354,7 @@ get_nouveau_entries0(IdxProps, Doc) ->
     Fields =
         if
             not DefaultEnabled -> Fields0;
-            true -> add_default_text_field(Fields0)
+            true -> add_default_text_field_nouveau(Fields0)
         end,
     FieldNames0 = get_field_names(Fields),
     FieldNames1 = lists:map(fun convert_to_nouveau_string_field/1, FieldNames0),