From c313b95dac11a5f18e7677a1919f9f242cdd01a8 Mon Sep 17 00:00:00 2001 From: raz-mon Date: Thu, 9 May 2024 17:22:16 +0300 Subject: [PATCH 1/2] Initial docs for empty indexing --- content/commands/ft.create/index.md | 6 ++++++ .../develop/interact/search-and-query/query/combined.md | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/content/commands/ft.create/index.md b/content/commands/ft.create/index.md index b64fd400e..5f4ed2833 100644 --- a/content/commands/ft.create/index.md +++ b/content/commands/ft.create/index.md @@ -118,6 +118,10 @@ arguments: optional: true token: WITHSUFFIXTRIE type: pure-token + - name: isempty + optional: true + token: ISEMPTY + type: pure-token - arguments: - name: sortable token: SORTABLE @@ -258,6 +262,8 @@ after the SCHEMA keyword, declares which fields to index: - `CASESENSITIVE` for `TAG` attributes, keeps the original letter cases of the tags. If not specified, the characters are converted to lowercase. - `WITHSUFFIXTRIE` for `TEXT` and `TAG` attributes, keeps a suffix trie with all terms which match the suffix. It is used to optimize `contains` (*foo*) and `suffix` (*foo) queries. Otherwise, a brute-force search on the trie is performed. If suffix trie exists for some fields, these queries will be disabled for other fields. + + - `ISEMPTY` for `TEXT` and `TAG` attributes, allows you to index and search for empty strings. By default, empty strings are not indexed. ## Optional arguments diff --git a/content/develop/interact/search-and-query/query/combined.md b/content/develop/interact/search-and-query/query/combined.md index 87629f2f2..48a97b62d 100644 --- a/content/develop/interact/search-and-query/query/combined.md +++ b/content/develop/interact/search-and-query/query/combined.md @@ -144,4 +144,11 @@ Here is an example: FT.SEARCH idx:bikes_vss "(@price:[500 1000] @condition:{new})=>[KNN 3 @vector $query_vector]" PARAMS 2 "query_vector" "Z\xf8\x15:\xf23\xa1\xbfZ\x1dI>\r\xca9..." DIALECT 2 ``` -The [vector search article]({{< relref "/develop/interact/search-and-query/query/vector-search" >}}) provides further details about vector queries in general. \ No newline at end of file +The [vector search article]({{< relref "/develop/interact/search-and-query/query/vector-search" >}}) provides further details about vector queries in general. + +## Empty values +You can use the simple `isempty(@field)` to query for fields containing empty values (i.e., empty strings for TEXT and TAG fields). + +``` +FT.SEARCH idx:bikes "isempty(@description) | @description:(kids | small)" +``` From f95c2f5fe99717f2bdc20533b4e50adfe6d584bf Mon Sep 17 00:00:00 2001 From: raz-mon Date: Thu, 6 Jun 2024 20:51:33 +0300 Subject: [PATCH 2/2] Renaming empty indexing --- content/commands/ft.create/index.md | 6 +++--- .../develop/interact/search-and-query/query/combined.md | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/content/commands/ft.create/index.md b/content/commands/ft.create/index.md index 5f4ed2833..b40846f52 100644 --- a/content/commands/ft.create/index.md +++ b/content/commands/ft.create/index.md @@ -118,9 +118,9 @@ arguments: optional: true token: WITHSUFFIXTRIE type: pure-token - - name: isempty + - name: indexempty optional: true - token: ISEMPTY + token: INDEXEMPTY type: pure-token - arguments: - name: sortable @@ -263,7 +263,7 @@ after the SCHEMA keyword, declares which fields to index: - `WITHSUFFIXTRIE` for `TEXT` and `TAG` attributes, keeps a suffix trie with all terms which match the suffix. It is used to optimize `contains` (*foo*) and `suffix` (*foo) queries. Otherwise, a brute-force search on the trie is performed. If suffix trie exists for some fields, these queries will be disabled for other fields. - - `ISEMPTY` for `TEXT` and `TAG` attributes, allows you to index and search for empty strings. By default, empty strings are not indexed. + - `INDEXEMPTY` for `TEXT` and `TAG` attributes, allows you to index and search for empty strings. By default, empty strings are not indexed. ## Optional arguments diff --git a/content/develop/interact/search-and-query/query/combined.md b/content/develop/interact/search-and-query/query/combined.md index 48a97b62d..c6344bcf8 100644 --- a/content/develop/interact/search-and-query/query/combined.md +++ b/content/develop/interact/search-and-query/query/combined.md @@ -145,10 +145,3 @@ FT.SEARCH idx:bikes_vss "(@price:[500 1000] @condition:{new})=>[KNN 3 @vector $q ``` The [vector search article]({{< relref "/develop/interact/search-and-query/query/vector-search" >}}) provides further details about vector queries in general. - -## Empty values -You can use the simple `isempty(@field)` to query for fields containing empty values (i.e., empty strings for TEXT and TAG fields). - -``` -FT.SEARCH idx:bikes "isempty(@description) | @description:(kids | small)" -```