66
77class _ObjectTTLCreate (_ConfigCreateModel ):
88 enabled : bool = True
9- postSearchFilter : Optional [bool ]
9+ filterExpiredObjects : Optional [bool ]
1010 deleteOn : Optional [str ]
1111 defaultTtl : Optional [int ]
1212
@@ -17,60 +17,60 @@ class _ObjectTTL:
1717 @staticmethod
1818 def delete_by_update_time (
1919 time_to_live : int | datetime .timedelta ,
20- post_search_filter : Optional [bool ] = None ,
20+ filter_expired_objects : Optional [bool ] = None ,
2121 ) -> _ObjectTTLCreate :
2222 """Create an `ObjectTimeToLiveConfig` object to be used when defining the object time-to-live configuration of Weaviate.
2323
2424 Args:
25- time_to_live: The time-to-live for objects in seconds.
26- post_search_filter : If enabled search results will be filtered to remove expired objects that have not yet been deleted .
25+ time_to_live: The time-to-live for objects in relation to their last update time ( seconds). Must be positive .
26+ filter_expired_objects : If enabled, exclude expired but not deleted objects from search results .
2727 """
2828 if isinstance (time_to_live , datetime .timedelta ):
2929 time_to_live = int (time_to_live .total_seconds ())
3030 return _ObjectTTLCreate (
3131 deleteOn = "_lastUpdateTimeUnix" ,
32- postSearchFilter = post_search_filter ,
32+ filterExpiredObjects = filter_expired_objects ,
3333 defaultTtl = time_to_live ,
3434 )
3535
3636 @staticmethod
3737 def delete_by_creation_time (
3838 time_to_live : int | datetime .timedelta ,
39- post_search_filter : Optional [bool ] = None ,
39+ filter_expired_objects : Optional [bool ] = None ,
4040 ) -> _ObjectTTLCreate :
4141 """Create an `ObjectTimeToLiveConfig` object to be used when defining the object time-to-live configuration of Weaviate.
4242
4343 Args:
44- time_to_live: The time-to-live for objects in seconds. Must be a positive value .
45- post_search_filter : If enabled search results will be filtered to remove expired objects that have not yet been deleted .
44+ time_to_live: The time-to-live for objects in relation to their creation time ( seconds) . Must be positive.
45+ filter_expired_objects : If enabled, exclude expired but not deleted objects from search results .
4646 """
4747 if isinstance (time_to_live , datetime .timedelta ):
4848 time_to_live = int (time_to_live .total_seconds ())
4949 return _ObjectTTLCreate (
5050 deleteOn = "_creationTimeUnix" ,
51- postSearchFilter = post_search_filter ,
51+ filterExpiredObjects = filter_expired_objects ,
5252 defaultTtl = time_to_live ,
5353 )
5454
5555 @staticmethod
5656 def delete_by_date_property (
57- date_property : str ,
58- time_to_live_after_date : Optional [int | datetime .timedelta ] = None ,
59- post_search_filter : Optional [bool ] = None ,
57+ property_name : str ,
58+ ttl_offset : Optional [int | datetime .timedelta ] = None ,
59+ filter_expired_objects : Optional [bool ] = None ,
6060 ) -> _ObjectTTLCreate :
6161 """Create an Object ttl config for a custom date property.
6262
6363 Args:
64- date_property : The name of the date property to use for object expiration.
65- time_to_live_after_date : The time-to-live for objects in seconds after the date property value . Can be negative
66- post_search_filter : If enabled search results will be filtered to remove expired objects that have not yet been deleted .
64+ property_name : The name of the date property to use for object expiration.
65+ ttl_offset : The time-to-live for objects relative to the date (seconds if integer) . Can be negative for indicating that objects should expire before the date property value.
66+ filter_expired_objects : If enabled, exclude expired but not deleted objects from search results .
6767 """
68- if isinstance (time_to_live_after_date , datetime .timedelta ):
69- time_to_live_after_date = int (time_to_live_after_date .total_seconds ())
70- if time_to_live_after_date is None :
71- time_to_live_after_date = 0
68+ if isinstance (ttl_offset , datetime .timedelta ):
69+ ttl_offset = int (ttl_offset .total_seconds ())
70+ if ttl_offset is None :
71+ ttl_offset = 0
7272 return _ObjectTTLCreate (
73- deleteOn = date_property ,
74- postSearchFilter = post_search_filter ,
75- defaultTtl = time_to_live_after_date ,
73+ deleteOn = property_name ,
74+ filterExpiredObjects = filter_expired_objects ,
75+ defaultTtl = ttl_offset ,
7676 )
0 commit comments