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

rnewson pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new d7a082af2 mango: chase changes in `mango_idx_text`
     new 2d0e6a585 Merge pull request #4660 from pgj/fix/mango_idx_nouveau-regex
d7a082af2 is described below

commit d7a082af2baaa880059e007077f1f28c91e9a02b
Author: Gabor Pali <[email protected]>
AuthorDate: Sat Jul 1 00:36:54 2023 +0200

    mango: chase changes in `mango_idx_text`
    
    Commit f40147b2 was not added for the Nouveau index module.  This
    could lead to a failure when `indexable_fields/1` is called with a
    selector that contains the `$regex` operator.
---
 src/mango/src/mango_idx_nouveau.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mango/src/mango_idx_nouveau.erl 
b/src/mango/src/mango_idx_nouveau.erl
index 0816898a1..d31b7502c 100644
--- a/src/mango/src/mango_idx_nouveau.erl
+++ b/src/mango/src/mango_idx_nouveau.erl
@@ -346,8 +346,6 @@ indexable_fields(Fields, {op_not, {ExistsQuery, Arg}}) when 
is_tuple(Arg) ->
 % forces "$exists" : false to use _all_docs
 indexable_fields(_, {op_not, {_, false}}) ->
     [];
-indexable_fields(Fields, {op_insert, Arg}) when is_binary(Arg) ->
-    Fields;
 %% fieldname.[]:length is not a user defined field.
 indexable_fields(Fields, {op_field, {[_, <<":length">>], _}}) ->
     Fields;
@@ -362,6 +360,8 @@ indexable_fields(Fields, {op_fieldname, {_, _}}) ->
 %% Similar idea to op_fieldname but with fieldname:null
 indexable_fields(Fields, {op_null, {_, _}}) ->
     Fields;
+indexable_fields(Fields, {op_regex, Name}) ->
+    [iolist_to_binary([Name, ":string"]) | Fields];
 indexable_fields(Fields, {op_default, _}) ->
     [<<"$default">> | Fields].
 

Reply via email to