@@ -1378,12 +1378,18 @@ def outer_type_or_annotation(field: FieldInfo):
13781378def should_index_field (field_info : PydanticFieldInfo ) -> bool :
13791379 # for vector, full text search, and sortable fields, we always have to index
13801380 # 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
13871393
13881394
13891395class RedisModel (BaseModel , abc .ABC , metaclass = ModelMeta ):
0 commit comments