Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mc-efc-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ typedef enum _supported_query_type_flags {
SUPPORTS_RANGE_PREVIEW_DEPRECATED_QUERIES = 1 << 2,
// Text search preview query supported
SUPPORTS_SUBSTRING_PREVIEW_QUERIES = 1 << 3,
SUPPORTS_SUFFIX_PREVIEW_QUERIES = 1 << 4,
SUPPORTS_PREFIX_PREVIEW_QUERIES = 1 << 5,
SUPPORTS_SUFFIX_QUERIES = 1 << 4,
SUPPORTS_PREFIX_QUERIES = 1 << 5,
} supported_query_type_flags;

typedef struct _mc_EncryptedField_t {
Expand Down
13 changes: 7 additions & 6 deletions src/mc-efc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ static bool _parse_query_type_string(const char *queryType, supported_query_type
*out = SUPPORTS_RANGE_PREVIEW_DEPRECATED_QUERIES;
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_STR), qtv)) {
*out = SUPPORTS_SUBSTRING_PREVIEW_QUERIES;
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_STR), qtv)) {
*out = SUPPORTS_SUFFIX_PREVIEW_QUERIES;
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_STR), qtv)) {
*out = SUPPORTS_PREFIX_PREVIEW_QUERIES;
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED_STR), qtv)
|| mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIX_STR), qtv)) {
*out = SUPPORTS_SUFFIX_QUERIES;
} else if (mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR), qtv)
|| mstr_eq_ignore_case(mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIX_STR), qtv)) {
*out = SUPPORTS_PREFIX_QUERIES;
} else {
return false;
}
Expand Down Expand Up @@ -240,8 +242,7 @@ bool mc_EncryptedFieldConfig_parse(mc_EncryptedFieldConfig_t *efc,

if (!bson_iter_init_find(&iter, efc_bson, "strEncodeVersion")) {
if (all_supported_queries
& (SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_PREVIEW_QUERIES
| SUPPORTS_PREFIX_PREVIEW_QUERIES)) {
& (SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES)) {
// Has at least one text search query type, set to latest by default.
efc->str_encode_version = LATEST_STR_ENCODE_VERSION;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/mc-textopts.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,11 @@ bool mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(const mc_TextOpts_t *txo,
CLIENT_ERR("Unexpected query type: %s\n", _mongocrypt_query_type_to_string(query_type));
return false;
}
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW: {
case MONGOCRYPT_QUERY_TYPE_PREFIX: {
include_prefix = true;
break;
}
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW: {
case MONGOCRYPT_QUERY_TYPE_SUFFIX: {
include_suffix = true;
break;
}
Expand Down
24 changes: 12 additions & 12 deletions src/mongocrypt-ctx-encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ static moe_result must_omit_encryptionInformation(const char *command_name,
bool has_fields_requiring_ei = false;
for (const mc_EncryptedField_t *ef = efc->fields; ef != NULL; ef = ef->next) {
if (ef->supported_queries
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_PREVIEW_QUERIES
| SUPPORTS_PREFIX_PREVIEW_QUERIES)) {
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES
| SUPPORTS_PREFIX_QUERIES)) {
has_fields_requiring_ei = true;
break;
}
Expand Down Expand Up @@ -1011,8 +1011,8 @@ static bool _fle2_append_compactionTokens(mongocrypt_t *crypt,
const _mongocrypt_buffer_t *ecoct_buf = mc_ECOCToken_get(ecoct);

if (ptr->supported_queries
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_PREVIEW_QUERIES
| SUPPORTS_PREFIX_PREVIEW_QUERIES)) {
& (SUPPORTS_RANGE_QUERIES | SUPPORTS_SUBSTRING_PREVIEW_QUERIES | SUPPORTS_SUFFIX_QUERIES
| SUPPORTS_PREFIX_QUERIES)) {
// Append the document {ecoc: <ECOCToken>, anchorPaddingToken: <AnchorPaddingTokenRoot>}
esct = mc_ESCToken_new(crypto, cl1t, status);
if (!esct) {
Expand Down Expand Up @@ -1520,8 +1520,8 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
_mongocrypt_ctx_fail_w_msg(ctx, "Cannot use rangePreview query type with Range V2");
goto fail;
// fallthrough
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW:
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW:
case MONGOCRYPT_QUERY_TYPE_SUFFIX:
case MONGOCRYPT_QUERY_TYPE_PREFIX:
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW:
case MONGOCRYPT_QUERY_TYPE_RANGE:
case MONGOCRYPT_QUERY_TYPE_EQUALITY: marking.u.fle2.type = MONGOCRYPT_FLE2_PLACEHOLDER_TYPE_FIND; break;
Expand Down Expand Up @@ -2087,14 +2087,14 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms

if (ctx->opts.query_type.set) {
const mongocrypt_query_type_t qt = ctx->opts.query_type.value;
if (qt == MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW) {
if (qt == MONGOCRYPT_QUERY_TYPE_PREFIX) {
if (!(ctx->opts.index_type.set && ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW)) {
return _mongocrypt_ctx_fail_w_msg(ctx, "prefixPreview query type requires textPreview index type");
return _mongocrypt_ctx_fail_w_msg(ctx, "prefix query type requires textPreview index type");
}
}
if (qt == MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW) {
if (qt == MONGOCRYPT_QUERY_TYPE_SUFFIX) {
if (!(ctx->opts.index_type.set && ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW)) {
return _mongocrypt_ctx_fail_w_msg(ctx, "suffixPreview query type requires textPreview index type");
return _mongocrypt_ctx_fail_w_msg(ctx, "suffix query type requires textPreview index type");
}
}
if (qt == MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW) {
Expand Down Expand Up @@ -2180,8 +2180,8 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
matches = (ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_EQUALITY);
break;
// fallthrough
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW:
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW:
case MONGOCRYPT_QUERY_TYPE_PREFIX:
case MONGOCRYPT_QUERY_TYPE_SUFFIX:
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW:
matches = (ctx->opts.index_type.value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW);
break;
Expand Down
4 changes: 2 additions & 2 deletions src/mongocrypt-ctx-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ typedef enum _mongocrypt_query_type_t {
MONGOCRYPT_QUERY_TYPE_EQUALITY = 1,
MONGOCRYPT_QUERY_TYPE_RANGE = 2,
MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED = 3,
MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW = 4,
MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW = 5,
MONGOCRYPT_QUERY_TYPE_PREFIX = 4,
MONGOCRYPT_QUERY_TYPE_SUFFIX = 5,
MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW = 6,
} mongocrypt_query_type_t;

Expand Down
22 changes: 16 additions & 6 deletions src/mongocrypt-ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,21 @@ bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_t
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED_STR))) {
_mongocrypt_ctx_fail_w_msg(ctx, "Query type 'rangePreview' is deprecated, please use 'range'");
return false;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_STR))) {
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIX_STR))) {
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_PREFIX;
ctx->opts.query_type.set = true;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_STR))) {
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIX_STR))) {
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUFFIX;
ctx->opts.query_type.set = true;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR))) {
// TODO: MONGOCRYPT-870 disallow prefixPreview
// _mongocrypt_ctx_fail_w_msg(ctx, "Query type 'prefixPreview' is deprecated, please use 'prefix'");
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_PREFIX;
ctx->opts.query_type.set = true;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED_STR))) {
// TODO: MONGOCRYPT-870 disallow suffixPreview
// _mongocrypt_ctx_fail_w_msg(ctx, "Query type 'suffixPreview' is deprecated, please use 'suffix'");
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUFFIX;
ctx->opts.query_type.set = true;
} else if (mstr_eq_ignore_case(qt_str, mstrv_lit(MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_STR))) {
ctx->opts.query_type.value = MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW;
Expand Down Expand Up @@ -1058,8 +1068,8 @@ const char *_mongocrypt_query_type_to_string(mongocrypt_query_type_t val) {
case MONGOCRYPT_QUERY_TYPE_EQUALITY: return "Equality";
case MONGOCRYPT_QUERY_TYPE_RANGEPREVIEW_DEPRECATED: return "RangePreview";
case MONGOCRYPT_QUERY_TYPE_RANGE: return "Range";
case MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW: return "PrefixPreview";
case MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW: return "SuffixPreview";
case MONGOCRYPT_QUERY_TYPE_PREFIX: return "Prefix";
case MONGOCRYPT_QUERY_TYPE_SUFFIX: return "Suffix";
case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW: return "SubstringPreview";
default: return "Unknown";
}
Expand Down
10 changes: 6 additions & 4 deletions src/mongocrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1599,9 +1599,11 @@ bool mongocrypt_setopt_key_expiration(mongocrypt_t *crypt, uint64_t cache_expira
#define MONGOCRYPT_QUERY_TYPE_RANGE_STR "range"
/// NOTE: "substringPreview" is experimental and may be removed in a future non-major release.
#define MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW_STR "substringPreview"
/// NOTE: "suffixPreview" is experimental and may be removed in a future non-major release.
#define MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_STR "suffixPreview"
/// NOTE: "prefixPreview" is experimental and may be removed in a future non-major release.
#define MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_STR "prefixPreview"
/// DEPRECATED: Support for "suffixPreview" has been removed in favor of "suffix"
#define MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED_STR "suffixPreview"
#define MONGOCRYPT_QUERY_TYPE_SUFFIX_STR "suffix"
/// DEPRECATED: Support for "prefixPreview" has been removed in favor of "suffix"
#define MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR "prefixPreview"
#define MONGOCRYPT_QUERY_TYPE_PREFIX_STR "prefix"

#endif /* MONGOCRYPT_H */
24 changes: 24 additions & 0 deletions test/data/efc/efc-textSearchFields.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@
}
}
]
},
{
"keyId": {
"$binary": {
"base64": "EjRWeBI0mHYSNBI0VqvN7w==",
"subType": "04"
}
},
"path": "middleName",
"bsonType": "string",
"queries": [
{
"queryType": "suffix",
"contention": {
"$numberLong": "0"
}
},
{
"queryType": "prefix",
"contention": {
"$numberLong": "0"
}
}
]
}
]
}
12 changes: 10 additions & 2 deletions test/test-mc-efc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ static void _test_efc(_mongocrypt_tester_t *tester) {
mongocrypt_status_t *status = mongocrypt_status_new();
_mongocrypt_buffer_t expect_keyId1;
_mongocrypt_buffer_t expect_keyId2;
_mongocrypt_buffer_t expect_keyId3;

_mongocrypt_buffer_copy_from_hex(&expect_keyId1, "12345678123498761234123456789012");
_mongocrypt_buffer_copy_from_hex(&expect_keyId2, "abcdefab123498761234123456789012");
_mongocrypt_buffer_copy_from_hex(&expect_keyId3, "12345678123498761234123456abcdef");

{
_load_test_file(tester, "./test/data/efc/efc-oneField.json", &efc_bson);
Expand Down Expand Up @@ -110,9 +112,14 @@ static void _test_efc(_mongocrypt_tester_t *tester) {
ASSERT_CMPUINT8(efc.str_encode_version, ==, LATEST_STR_ENCODE_VERSION);
ptr = efc.fields;
ASSERT(ptr);
ASSERT_STREQUAL(ptr->path, "middleName");
ASSERT_CMPBUF(expect_keyId3, ptr->keyId);
ASSERT(ptr->supported_queries == (SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES));
ASSERT(ptr->next != NULL);
ptr = ptr->next;
ASSERT_STREQUAL(ptr->path, "lastName");
ASSERT_CMPBUF(expect_keyId2, ptr->keyId);
ASSERT(ptr->supported_queries == (SUPPORTS_SUFFIX_PREVIEW_QUERIES | SUPPORTS_PREFIX_PREVIEW_QUERIES));
ASSERT(ptr->supported_queries == (SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES));
ASSERT(ptr->next != NULL);
ptr = ptr->next;
ASSERT_STREQUAL(ptr->path, "firstName");
Expand All @@ -130,7 +137,7 @@ static void _test_efc(_mongocrypt_tester_t *tester) {
ASSERT(ptr);
ASSERT_STREQUAL(ptr->path, "lastName");
ASSERT_CMPBUF(expect_keyId2, ptr->keyId);
ASSERT(ptr->supported_queries == (SUPPORTS_SUFFIX_PREVIEW_QUERIES | SUPPORTS_PREFIX_PREVIEW_QUERIES));
ASSERT(ptr->supported_queries == (SUPPORTS_SUFFIX_QUERIES | SUPPORTS_PREFIX_QUERIES));
ASSERT(ptr->next != NULL);
ptr = ptr->next;
ASSERT_STREQUAL(ptr->path, "firstName");
Expand Down Expand Up @@ -158,6 +165,7 @@ static void _test_efc(_mongocrypt_tester_t *tester) {
_mongocrypt_status_reset(status);
}

_mongocrypt_buffer_cleanup(&expect_keyId3);
_mongocrypt_buffer_cleanup(&expect_keyId2);
_mongocrypt_buffer_cleanup(&expect_keyId1);
mongocrypt_status_destroy(status);
Expand Down
8 changes: 4 additions & 4 deletions test/test-mc-textopts.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static void test_mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(_mongocrypt_t
"prefix" : {"strMinQueryLength" : 3, "strMaxQueryLength" : 8}
}),
.v = RAW_STRING({"v" : "test"}),
.qt = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW,
.qt = MONGOCRYPT_QUERY_TYPE_PREFIX,
.expect =
RAW_STRING({"v" : {"v" : "test", "casef" : true, "diacf" : false, "prefix" : {"ub" : 8, "lb" : 3}}})},
{.desc = "Works with suffix",
Expand All @@ -265,7 +265,7 @@ static void test_mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(_mongocrypt_t
"suffix" : {"strMinQueryLength" : 3, "strMaxQueryLength" : 8}
}),
.v = RAW_STRING({"v" : "test"}),
.qt = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW,
.qt = MONGOCRYPT_QUERY_TYPE_SUFFIX,
.expect =
RAW_STRING({"v" : {"v" : "test", "casef" : true, "diacf" : false, "suffix" : {"ub" : 8, "lb" : 3}}})},
{.desc = "Works with prefix + suffix when querying prefix",
Expand All @@ -276,7 +276,7 @@ static void test_mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(_mongocrypt_t
"suffix" : {"strMinQueryLength" : 3, "strMaxQueryLength" : 8}
}),
.v = RAW_STRING({"v" : "test"}),
.qt = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW,
.qt = MONGOCRYPT_QUERY_TYPE_PREFIX,
.expect =
RAW_STRING({"v" : {"v" : "test", "casef" : true, "diacf" : false, "prefix" : {"ub" : 9, "lb" : 4}}})},
{.desc = "Works with prefix + suffix when querying suffix",
Expand All @@ -287,7 +287,7 @@ static void test_mc_TextOpts_to_FLE2TextSearchInsertSpec_for_query(_mongocrypt_t
"suffix" : {"strMinQueryLength" : 3, "strMaxQueryLength" : 8}
}),
.v = RAW_STRING({"v" : "test"}),
.qt = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW,
.qt = MONGOCRYPT_QUERY_TYPE_SUFFIX,
.expect =
RAW_STRING({"v" : {"v" : "test", "casef" : true, "diacf" : false, "suffix" : {"ub" : 8, "lb" : 3}}})},
};
Expand Down
42 changes: 39 additions & 3 deletions test/test-mongocrypt-ctx-encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2478,7 +2478,7 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
ee_testcase tc = {0};
tc.desc = "find suffix";
tc.algorithm = MONGOCRYPT_ALGORITHM_TEXTPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_SUFFIXPREVIEW_DEPRECATED_STR;
tc.contention_factor = OPT_I64(1);
tc.msg = TEST_BSON("{'v': 'abc'}");
tc.user_key_id = &keyABC_id;
Expand All @@ -2496,7 +2496,43 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
ee_testcase tc = {0};
tc.desc = "find prefix";
tc.algorithm = MONGOCRYPT_ALGORITHM_TEXTPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR;
tc.contention_factor = OPT_I64(1);
tc.msg = TEST_BSON("{'v': 'abc'}");
tc.user_key_id = &keyABC_id;
tc.keys_to_feed[0] = keyABC;
tc.text_opts = TEST_BSON(RAW_STRING({
"caseSensitive" : false,
"diacriticSensitive" : false,
"prefix" : {"strMinQueryLength" : 1, "strMaxQueryLength" : 100}
}));
tc.expect = TEST_FILE("./test/data/fle2-explicit/find-prefix.json");
ee_testcase_run(&tc);
}

{
ee_testcase tc = {0};
tc.desc = "find suffix";
tc.algorithm = MONGOCRYPT_ALGORITHM_TEXTPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_SUFFIX_STR;
tc.contention_factor = OPT_I64(1);
tc.msg = TEST_BSON("{'v': 'abc'}");
tc.user_key_id = &keyABC_id;
tc.keys_to_feed[0] = keyABC;
tc.text_opts = TEST_BSON(RAW_STRING({
"caseSensitive" : false,
"diacriticSensitive" : false,
"suffix" : {"strMinQueryLength" : 1, "strMaxQueryLength" : 100}
}));
tc.expect = TEST_FILE("./test/data/fle2-explicit/find-suffix.json");
ee_testcase_run(&tc);
}

{
ee_testcase tc = {0};
tc.desc = "find prefix";
tc.algorithm = MONGOCRYPT_ALGORITHM_TEXTPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_PREFIX_STR;
tc.contention_factor = OPT_I64(1);
tc.msg = TEST_BSON("{'v': 'abc'}");
tc.user_key_id = &keyABC_id;
Expand Down Expand Up @@ -2637,7 +2673,7 @@ static void _test_encrypt_fle2_explicit(_mongocrypt_tester_t *tester) {
tc.msg = TEST_BSON("{'v': 'abc'}");
tc.user_key_id = &keyABC_id;
tc.keys_to_feed[0] = keyABC;
tc.query_type = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_STR;
tc.query_type = MONGOCRYPT_QUERY_TYPE_PREFIXPREVIEW_DEPRECATED_STR;
tc.text_opts = TEST_BSON(RAW_STRING({
"caseSensitive" : false,
"diacriticSensitive" : false,
Expand Down
Loading