Skip to content

Commit

Permalink
feat: make string search case incensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubfaouzi committed Sep 20, 2024
1 parent 6f12756 commit df797c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions db/count-strings.n1ql
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ SELECT RAW
ARRAY_LENGTH (
ARRAY_FLATTEN (
[
ARRAY {"value": s, "encoding": "ascii"} FOR s IN f.strings.ascii WHEN s LIKE $term END,
ARRAY {"value": s, "encoding": "wide"} FOR s IN f.strings.wide WHEN s LIKE $term END,
ARRAY {"value": s, "encoding": "asm"} FOR s IN f.strings.asm WHEN s LIKE $term END
ARRAY {"value": s, "encoding": "ascii"} FOR s IN f.strings.ascii WHEN LOWER(s) LIKE LOWER($term) END,
ARRAY {"value": s, "encoding": "wide"} FOR s IN f.strings.wide WHEN LOWER(s) LIKE LOWER($term) END,
ARRAY {"value": s, "encoding": "asm"} FOR s IN f.strings.asm WHEN LOWER(s) LIKE LOWER($term) END
], 1 )
)

Expand Down
6 changes: 3 additions & 3 deletions db/file-strings.n1ql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SELECT RAW
ARRAY_FLATTEN (
[
ARRAY {"value": s, "encoding": "ascii"} FOR s IN f.strings.ascii WHEN s LIKE $term END,
ARRAY {"value": s, "encoding": "wide"} FOR s IN f.strings.wide WHEN s LIKE $term END,
ARRAY {"value": s, "encoding": "asm"} FOR s IN f.strings.asm WHEN s LIKE $term END
ARRAY {"value": s, "encoding": "ascii"} FOR s IN f.strings.ascii WHEN LOWER(s) LIKE LOWER($term) END,
ARRAY {"value": s, "encoding": "wide"} FOR s IN f.strings.wide WHEN LOWER(s) LIKE LOWER($term) END,
ARRAY {"value": s, "encoding": "asm"} FOR s IN f.strings.asm WHEN LOWER(s) LIKE LOWER($term) END
], 1 )[$offset:$limit]

FROM `bucket_name` f
Expand Down

0 comments on commit df797c5

Please sign in to comment.