From d21b94258fbcdb0a7cd5693103b1ff73c3d7a2f4 Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Tue, 8 Oct 2024 15:20:26 +0200 Subject: [PATCH 1/4] add STARTS_WITH to filter expression reference --- .../filter_expression_reference.mdx | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/learn/filtering_and_sorting/filter_expression_reference.mdx b/learn/filtering_and_sorting/filter_expression_reference.mdx index 1670d4118..1c504017f 100644 --- a/learn/filtering_and_sorting/filter_expression_reference.mdx +++ b/learn/filtering_and_sorting/filter_expression_reference.mdx @@ -161,7 +161,7 @@ NOT genres IN [horror, comedy] `CONTAINS` filters results containing partial matches to the specified string pattern, similar to a [SQL `LIKE`](https://dev.mysql.com/doc/refman/8.4/en/string-comparison-functions.html#operator_like). -The following expression returns all dairy products whose name start with `"kef"`, such as kefir: +The following expression returns all dairy products whose name contain `"kef"`: ``` dairy_products.name CONTAINS kef @@ -185,6 +185,40 @@ curl \ "containsFilter": true }' ``` + +This will also enable the [`STARTS_WITH`](#starts_with) operator. + + +### `STARTS_WITH` + +`STARTS_WITH` filters results whose values start with the specified string pattern. + +The following expression returns all dairy products whose name start with `"kef"`: + +``` +dairy_products.name STARTS_WITH kef +``` + +The negated form of the above expression can be written as: + +``` +dairy_products.name NOT STARTS_WITH kef +NOT dairy_product.name STARTS_WITH kef +``` + + +This is an experimental feature. Use the experimental features endpoint to activate it: + +```sh +curl \ + -X PATCH 'http://localhost:7700/experimental-features/' \ + -H 'Content-Type: application/json' \ + --data-binary '{ + "containsFilter": true + }' +``` + +This will also enable the [`CONTAINS`](#contains) operator. ### `NOT` From 7e245ce16d824042c698bf24bc00f1ee71d26899 Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Tue, 8 Oct 2024 17:22:17 +0200 Subject: [PATCH 2/4] grammar --- learn/filtering_and_sorting/filter_expression_reference.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn/filtering_and_sorting/filter_expression_reference.mdx b/learn/filtering_and_sorting/filter_expression_reference.mdx index 1c504017f..224741065 100644 --- a/learn/filtering_and_sorting/filter_expression_reference.mdx +++ b/learn/filtering_and_sorting/filter_expression_reference.mdx @@ -161,7 +161,7 @@ NOT genres IN [horror, comedy] `CONTAINS` filters results containing partial matches to the specified string pattern, similar to a [SQL `LIKE`](https://dev.mysql.com/doc/refman/8.4/en/string-comparison-functions.html#operator_like). -The following expression returns all dairy products whose name contain `"kef"`: +The following expression returns all dairy products whose names contain `"kef"`: ``` dairy_products.name CONTAINS kef From 899d9060868fd27f88db2612a0d349170e3c4157 Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Wed, 9 Oct 2024 13:10:01 +0200 Subject: [PATCH 3/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Renault --- .../filtering_and_sorting/filter_expression_reference.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/learn/filtering_and_sorting/filter_expression_reference.mdx b/learn/filtering_and_sorting/filter_expression_reference.mdx index 224741065..63f9d203f 100644 --- a/learn/filtering_and_sorting/filter_expression_reference.mdx +++ b/learn/filtering_and_sorting/filter_expression_reference.mdx @@ -186,7 +186,7 @@ curl \ }' ``` -This will also enable the [`STARTS_WITH`](#starts_with) operator. +This will also enable the [`STARTS WITH`](#starts_with) operator. ### `STARTS_WITH` @@ -196,14 +196,14 @@ This will also enable the [`STARTS_WITH`](#starts_with) operator. The following expression returns all dairy products whose name start with `"kef"`: ``` -dairy_products.name STARTS_WITH kef +dairy_products.name STARTS WITH kef ``` The negated form of the above expression can be written as: ``` -dairy_products.name NOT STARTS_WITH kef -NOT dairy_product.name STARTS_WITH kef +dairy_products.name NOT STARTS WITH kef +NOT dairy_product.name STARTS WITH kef ``` From 5ba8b22701c136d794c54e6953f6827334467bde Mon Sep 17 00:00:00 2001 From: gui machiavelli Date: Wed, 9 Oct 2024 13:47:53 +0200 Subject: [PATCH 4/4] correct remaining STARTS_WITH to STARTS WITH --- learn/filtering_and_sorting/filter_expression_reference.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/learn/filtering_and_sorting/filter_expression_reference.mdx b/learn/filtering_and_sorting/filter_expression_reference.mdx index 63f9d203f..b78675b5e 100644 --- a/learn/filtering_and_sorting/filter_expression_reference.mdx +++ b/learn/filtering_and_sorting/filter_expression_reference.mdx @@ -189,9 +189,9 @@ curl \ This will also enable the [`STARTS WITH`](#starts_with) operator. -### `STARTS_WITH` +### `STARTS WITH` -`STARTS_WITH` filters results whose values start with the specified string pattern. +`STARTS WITH` filters results whose values start with the specified string pattern. The following expression returns all dairy products whose name start with `"kef"`: @@ -206,7 +206,7 @@ dairy_products.name NOT STARTS WITH kef NOT dairy_product.name STARTS WITH kef ``` - + This is an experimental feature. Use the experimental features endpoint to activate it: ```sh