@@ -365,3 +365,83 @@ def test_indexmissing_enables_ismissing_query(self, client, redis_url, worker_id
365365 f"ismiss_{ worker_id } :3" ,
366366 )
367367 index .delete (drop = True )
368+
369+
370+ class TestFieldTypeModifierSupport :
371+ """Test that field types only support their documented modifiers."""
372+
373+ def test_numeric_field_does_not_support_index_empty (
374+ self , client , redis_url , worker_id
375+ ):
376+ """Verify that NumericField does not have index_empty attribute.
377+
378+ INDEXEMPTY is only supported for TEXT and TAG fields according to
379+ RediSearch documentation. NumericFieldAttributes should not have
380+ an index_empty attribute.
381+ """
382+ import inspect
383+
384+ from redisvl .schema .fields import NumericFieldAttributes
385+
386+ # Verify NumericFieldAttributes doesn't have index_empty
387+ attrs = inspect .signature (NumericFieldAttributes ).parameters
388+ assert (
389+ "index_empty" not in attrs
390+ ), "NumericFieldAttributes should not have index_empty parameter"
391+
392+ # Verify the attribute doesn't exist on the class
393+ field_attrs = NumericFieldAttributes ()
394+ assert not hasattr (
395+ field_attrs , "index_empty"
396+ ), "NumericFieldAttributes should not have index_empty attribute"
397+
398+ def test_geo_field_does_not_support_index_empty (self , client , redis_url , worker_id ):
399+ """Verify that GeoField does not have index_empty attribute.
400+
401+ INDEXEMPTY is only supported for TEXT and TAG fields according to
402+ RediSearch documentation. GeoFieldAttributes should not have
403+ an index_empty attribute.
404+ """
405+ import inspect
406+
407+ from redisvl .schema .fields import GeoFieldAttributes
408+
409+ # Verify GeoFieldAttributes doesn't have index_empty
410+ attrs = inspect .signature (GeoFieldAttributes ).parameters
411+ assert (
412+ "index_empty" not in attrs
413+ ), "GeoFieldAttributes should not have index_empty parameter"
414+
415+ # Verify the attribute doesn't exist on the class
416+ field_attrs = GeoFieldAttributes ()
417+ assert not hasattr (
418+ field_attrs , "index_empty"
419+ ), "GeoFieldAttributes should not have index_empty attribute"
420+
421+ def test_text_field_supports_index_empty (self , client , redis_url , worker_id ):
422+ """Verify that TextField supports index_empty attribute.
423+
424+ INDEXEMPTY is supported for TEXT fields according to RediSearch documentation.
425+ """
426+ from redisvl .schema .fields import TextFieldAttributes
427+
428+ # Verify TextFieldAttributes has index_empty
429+ field_attrs = TextFieldAttributes (index_empty = True )
430+ assert hasattr (
431+ field_attrs , "index_empty"
432+ ), "TextFieldAttributes should have index_empty attribute"
433+ assert field_attrs .index_empty is True
434+
435+ def test_tag_field_supports_index_empty (self , client , redis_url , worker_id ):
436+ """Verify that TagField supports index_empty attribute.
437+
438+ INDEXEMPTY is supported for TAG fields according to RediSearch documentation.
439+ """
440+ from redisvl .schema .fields import TagFieldAttributes
441+
442+ # Verify TagFieldAttributes has index_empty
443+ field_attrs = TagFieldAttributes (index_empty = True )
444+ assert hasattr (
445+ field_attrs , "index_empty"
446+ ), "TagFieldAttributes should have index_empty attribute"
447+ assert field_attrs .index_empty is True
0 commit comments