This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch native-nouveau in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 00bcfc26e5b252fdab463bcac0e5962e3efe8534 Author: Robert Newson <[email protected]> AuthorDate: Mon Aug 4 16:46:43 2025 +0100 add Index and NouveauIndex native funs WIP (needs tests) closes https://github.com/apache/couchdb/issues/5444 --- src/couch/src/couch_native_process.erl | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/couch/src/couch_native_process.erl b/src/couch/src/couch_native_process.erl index c9280f1d7..061e6770d 100644 --- a/src/couch/src/couch_native_process.erl +++ b/src/couch/src/couch_native_process.erl @@ -329,6 +329,47 @@ bindings(State, Sig, DDoc) -> erlang:put(Sig, [[Id, Value] | Curr]) end, + Index = fun(FieldName, FieldValue, Options) -> + Curr = erlang:get(Sig), + erlang:put(Sig, [[FieldName, FieldValue, Options] | Curr]) + end, + + NouveauIndex = fun(FieldType, FieldName, FieldValue, Options) -> + Curr = erlang:get(Sig), + case FieldType of + _ when FieldType == <<"double">>; FieldType == <<"string">> -> + erlang:put(Sig, [ + #{ + <<"@type">> => FieldType, + <<"name">> => FieldName, + <<"value">> => FieldValue, + <<"store">> => maps:get(store, Options, false), + <<"facet">> => maps:get(facet, Options, false) + } + | Curr + ]); + <<"text">> -> + erlang:put(Sig, [ + #{ + <<"@type">> => FieldType, + <<"name">> => FieldName, + <<"value">> => FieldValue, + <<"store">> => maps:get(store, Options, false) + } + | Curr + ]); + <<"stored">> -> + erlang:put(Sig, [ + #{ + <<"@type">> => FieldType, + <<"name">> => FieldName, + <<"value">> => FieldValue + } + | Curr + ]) + end + end, + Start = fun(Headers) -> erlang:put(list_headers, Headers) end, @@ -368,6 +409,8 @@ bindings(State, Sig, DDoc) -> Bindings = [ {'Log', Log}, {'Emit', Emit}, + {'Index', Index}, + {'NouveauIndex', NouveauIndex}, {'Start', Start}, {'Send', Send}, {'GetRow', GetRow},
