couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [couchdb] branch 3358-use-efficient-set updated: ignore type and value
Date Thu, 04 May 2017 06:14:42 GMT
This is an automated email from the ASF dual-hosted git repository.

tonysun83 pushed a commit to branch 3358-use-efficient-set
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/3358-use-efficient-set by this push:
       new  13f6bc3   ignore type and value
13f6bc3 is described below

commit 13f6bc370e23863c6ab228f68ede91fba452ee0f
Author: Tony Sun <tony.sun@cloudant.com>
AuthorDate: Wed May 3 23:14:54 2017 -0700

    ignore type and value
    
    duplicates could occur when just using gb_set:from_list
    
    COUCHDB-3358
---
 src/mango/src/mango_native_proc.erl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl
index f36d6f7..ba17c48 100644
--- a/src/mango/src/mango_native_proc.erl
+++ b/src/mango/src/mango_native_proc.erl
@@ -258,9 +258,10 @@ add_default_text_field([_ | Rest], Acc) ->
 
 %% index of all field names
 get_field_names(Fields) ->
-    GBFieldSet = gb_sets:from_list(Fields),
-    UFields = gb_sets:to_list(GBFieldSet),
-    [[<<"$fieldnames">>, Name, []] || {Name, _Type, _Value} <- UFields].
+    FieldNameSet = lists:foldl(fun({Name, _, _}, Set) ->
+        gb_sets:add([<<"$fieldnames">>, Name, []], Set)
+    end, gb_sets:new(), Fields),
+    gb_sets:to_list(FieldNameSet).
 
 
 convert_text_fields([]) ->

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message