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

[couchdb] branch 3358-use-efficient-set updated: ignore type and value

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 <to...@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" <co...@couchdb.apache.org>'].