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/10 10:08:05 UTC
[couchdb] 01/01: Support text field type for nouveau and error everything else
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch nouveau-mango-string-text
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 7cf36d96d22c961792d799df1aa1d0030da4112b
Author: Robert Newson <rn...@apache.org>
AuthorDate: Wed May 10 10:21:35 2023 +0100
Support text field type for nouveau and error everything else
---
src/mango/src/mango_error.erl | 11 +++++++++++
src/mango/src/mango_idx_nouveau.erl | 2 ++
2 files changed, 13 insertions(+)
diff --git a/src/mango/src/mango_error.erl b/src/mango/src/mango_error.erl
index 22cb37106..a8b5bfa4b 100644
--- a/src/mango/src/mango_error.erl
+++ b/src/mango/src/mango_error.erl
@@ -94,6 +94,17 @@ info(mango_cursor_nouveau, {nouveau_search_error, {error, Error}}) ->
<<"nouveau_search_error">>,
fmt("~p", [Error])
};
+info(mango_idx_nouveau, {invalid_index_fields_definition, Def}) ->
+ {
+ 400,
+ <<"invalid_index_fields_definition">>,
+ fmt(
+ "Text Index field definitions must be of the form\n"
+ " {\"name\": \"non-empty fieldname\", \"type\":\n"
+ " \"boolean,number,string or text\"}. Def: ~p",
+ [Def]
+ )
+ };
info(mango_fields, {invalid_fields_json, BadFields}) ->
{
400,
diff --git a/src/mango/src/mango_idx_nouveau.erl b/src/mango/src/mango_idx_nouveau.erl
index 074a755ee..a6e297e3d 100644
--- a/src/mango/src/mango_idx_nouveau.erl
+++ b/src/mango/src/mango_idx_nouveau.erl
@@ -183,6 +183,8 @@ validate_field_name(_) ->
validate_field_type(<<"string">>) ->
<<"string">>;
+validate_field_type(<<"text">>) ->
+ <<"text">>;
validate_field_type(<<"number">>) ->
<<"number">>;
validate_field_type(<<"boolean">>) ->