@@ -1378,12 +1378,18 @@ def outer_type_or_annotation(field: FieldInfo):
1378
1378
def should_index_field (field_info : PydanticFieldInfo ) -> bool :
1379
1379
# for vector, full text search, and sortable fields, we always have to index
1380
1380
# We could require the user to set index=True, but that would be a breaking change
1381
- return (
1382
- getattr (field_info , "index" , False ) is True
1383
- or getattr (field_info , "vector_options" , None ) is not None
1384
- or getattr (field_info , "full_text_search" , False ) is True
1385
- or getattr (field_info , "sortable" , False ) is True
1386
- )
1381
+ index = getattr (field_info , "index" , None ) is True
1382
+ vector_options = getattr (field_info , "vector_options" , None ) is not None
1383
+ full_text_search = getattr (field_info , "full_text_search" , None ) is True
1384
+ sortable = getattr (field_info , "sortable" , None ) is True
1385
+
1386
+ if index is False and any ([vector_options , full_text_search , sortable ]):
1387
+ log .warning (
1388
+ "Field is marked as index=False, but it is a vector, full text search, or sortable field. "
1389
+ "This will be ignored and the field will be indexed." ,
1390
+ )
1391
+
1392
+ return index or vector_options or full_text_search or sortable
1387
1393
1388
1394
1389
1395
class RedisModel (BaseModel , abc .ABC , metaclass = ModelMeta ):
0 commit comments