@@ -1539,7 +1539,7 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
15391539 goto fail ;
15401540 // fallthrough
15411541 case MONGOCRYPT_INDEX_TYPE_RANGE : marking .u .fle2 .algorithm = MONGOCRYPT_FLE2_ALGORITHM_RANGE ; break ;
1542- case MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW : marking .u .fle2 .algorithm = MONGOCRYPT_FLE2_ALGORITHM_TEXT_SEARCH ; break ;
1542+ case MONGOCRYPT_INDEX_TYPE_STRING : marking .u .fle2 .algorithm = MONGOCRYPT_FLE2_ALGORITHM_TEXT_SEARCH ; break ;
15431543 default :
15441544 // This might be unreachable because of other validation. Better safe than
15451545 // sorry.
@@ -1631,7 +1631,7 @@ static bool _fle2_finalize_explicit(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *
16311631 case MONGOCRYPT_INDEX_TYPE_EQUALITY :
16321632 case MONGOCRYPT_INDEX_TYPE_RANGEPREVIEW_DEPRECATED :
16331633 case MONGOCRYPT_INDEX_TYPE_RANGE :
1634- case MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW :
1634+ case MONGOCRYPT_INDEX_TYPE_STRING :
16351635 // All QE indexed algorithms require contention factor.
16361636 BSON_ASSERT (ctx -> opts .contention_factor .set ); // Checked earlier in explicit_encrypt_init.
16371637 marking .u .fle2 .maxContentionFactor = ctx -> opts .contention_factor .value ;
@@ -2088,18 +2088,18 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
20882088 if (ctx -> opts .query_type .set ) {
20892089 const mongocrypt_query_type_t qt = ctx -> opts .query_type .value ;
20902090 if (qt == MONGOCRYPT_QUERY_TYPE_PREFIX ) {
2091- if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW )) {
2092- return _mongocrypt_ctx_fail_w_msg (ctx , "prefix query type requires textPreview index type" );
2091+ if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING )) {
2092+ return _mongocrypt_ctx_fail_w_msg (ctx , "prefix query type requires string index type" );
20932093 }
20942094 }
20952095 if (qt == MONGOCRYPT_QUERY_TYPE_SUFFIX ) {
2096- if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW )) {
2097- return _mongocrypt_ctx_fail_w_msg (ctx , "suffix query type requires textPreview index type" );
2096+ if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING )) {
2097+ return _mongocrypt_ctx_fail_w_msg (ctx , "suffix query type requires string index type" );
20982098 }
20992099 }
21002100 if (qt == MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW ) {
2101- if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW )) {
2102- return _mongocrypt_ctx_fail_w_msg (ctx , "substringPreview query type requires textPreview index type" );
2101+ if (!(ctx -> opts .index_type .set && ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING )) {
2102+ return _mongocrypt_ctx_fail_w_msg (ctx , "substringPreview query type requires string index type" );
21032103 }
21042104 }
21052105 }
@@ -2113,14 +2113,14 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
21132113 return _mongocrypt_ctx_fail_w_msg (ctx , "cannot set range opts with equality index type" );
21142114 }
21152115
2116- if (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW ) {
2117- return _mongocrypt_ctx_fail_w_msg (ctx , "cannot set range opts with textPreview index type " );
2116+ if (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING ) {
2117+ return _mongocrypt_ctx_fail_w_msg (ctx , "cannot set range opts with 'string' algorithm " );
21182118 }
21192119 }
21202120
21212121 if (ctx -> opts .textopts .set && ctx -> opts .index_type .set ) {
2122- if (ctx -> opts .index_type .value != MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW ) {
2123- return _mongocrypt_ctx_fail_w_msg (ctx , "cannot set text opts without textPreview index type" );
2122+ if (ctx -> opts .index_type .value != MONGOCRYPT_INDEX_TYPE_STRING ) {
2123+ return _mongocrypt_ctx_fail_w_msg (ctx , "cannot set string opts without string index type" );
21242124 }
21252125 }
21262126
@@ -2147,13 +2147,13 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
21472147 }
21482148
21492149 // Check required options for text algorithm are set:
2150- if (ctx -> opts .index_type .set && (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW )) {
2150+ if (ctx -> opts .index_type .set && (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING )) {
21512151 if (!ctx -> opts .contention_factor .set ) {
2152- return _mongocrypt_ctx_fail_w_msg (ctx , "contention factor is required for textPreview algorithm" );
2152+ return _mongocrypt_ctx_fail_w_msg (ctx , "contention factor is required for string algorithm" );
21532153 }
21542154
21552155 if (!ctx -> opts .textopts .set ) {
2156- return _mongocrypt_ctx_fail_w_msg (ctx , "text opts are required for textPreview algorithm" );
2156+ return _mongocrypt_ctx_fail_w_msg (ctx , "string opts are required for string algorithm" );
21572157 }
21582158 }
21592159
@@ -2183,7 +2183,7 @@ static bool explicit_encrypt_init(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *ms
21832183 case MONGOCRYPT_QUERY_TYPE_PREFIX :
21842184 case MONGOCRYPT_QUERY_TYPE_SUFFIX :
21852185 case MONGOCRYPT_QUERY_TYPE_SUBSTRINGPREVIEW :
2186- matches = (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_TEXTPREVIEW );
2186+ matches = (ctx -> opts .index_type .value == MONGOCRYPT_INDEX_TYPE_STRING );
21872187 break ;
21882188 default :
21892189 CLIENT_ERR ("unsupported value for query_type: %d" , (int )ctx -> opts .query_type .value );
0 commit comments