@@ -94,13 +94,28 @@ def __init__(self, atlan_field_name: StrictStr, elastic_field_name: StrictStr):
9494 def internal_field_name (self ):
9595 return self .atlan_field_name
9696
97- def has_any_value (self ) -> Query :
97+ def has_any_value (
98+ self ,
99+ field_type : Optional [AtlanSearchableFieldType ] = None ,
100+ ) -> Query :
98101 """
99102 Returns a query that will only match assets that have some non-null, non-empty value
100103 (no matter what actual value) for the field.
101104
105+ Note: When text exceeds a particular length (5K characters), the keyword field on an
106+ attribute can be empty while the text field on the same attribute is populated.
107+ For KeywordTextField types, use field_type=AtlanSearchableFieldType.TEXT to check
108+ the text field instead. For other field types, this parameter is ignored.
109+
110+ :param field_type: optional field type to check for existence (KEYWORD or TEXT).
111+ Only applicable for KeywordTextField types.
112+ Defaults to KEYWORD (None) for backwards compatibility.
102113 :returns: a query that will only match assets that have some non-null, non-empty value for the field
103114 """
115+ if field_type == AtlanSearchableFieldType .TEXT and hasattr (
116+ self , "_text_field_name"
117+ ):
118+ return Exists (field = self ._text_field_name )
104119 return Exists (field = self .elastic_field_name )
105120
106121 def order (self , order : SortOrder = SortOrder .ASCENDING ) -> SortItem :
@@ -577,26 +592,6 @@ def __init__(
577592 def text_field_name (self ) -> str :
578593 return self ._text_field_name
579594
580- def has_any_value (
581- self , field_type : AtlanSearchableFieldType = AtlanSearchableFieldType .KEYWORD
582- ) -> Query :
583- """
584- Returns a query that will only match assets that have some non-null, non-empty value
585- (no matter what actual value) for the field.
586-
587- Note: When text exceeds a particular length (5K characters), the keyword field on an
588- attribute can be empty while the text field on the same attribute is populated.
589- Use field_type=AtlanSearchableFieldType.TEXT to check the text field instead,
590- which is useful when field values may exceed 5K characters.
591-
592- :param field_type: which field index to check for existence (KEYWORD or TEXT).
593- Defaults to KEYWORD for backwards compatibility.
594- :returns: a query that will only match assets that have some non-null, non-empty value for the field
595- """
596- if field_type == AtlanSearchableFieldType .TEXT :
597- return Exists (field = self ._text_field_name )
598- return Exists (field = self .elastic_field_name )
599-
600595
601596class InternalKeywordTextField (KeywordTextField ):
602597 """Represents any field in Atlan that can be searched by keyword or text-based search operations, and can also
0 commit comments