@@ -41,7 +41,7 @@ def delete_by_creation_time(
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.
44+ time_to_live: The time-to-live for objects in seconds. Must be a positive value.
4545 post_search_filter: If enabled search results will be filtered to remove expired objects that have not yet been deleted.
4646 """
4747 if isinstance (time_to_live , datetime .timedelta ):
@@ -55,16 +55,22 @@ def delete_by_creation_time(
5555 @staticmethod
5656 def delete_by_date_property (
5757 date_property : str ,
58+ time_to_live_after_date : Optional [int | datetime .timedelta ] = None ,
5859 post_search_filter : Optional [bool ] = None ,
5960 ) -> _ObjectTTLCreate :
6061 """Create an Object ttl config for a custom date property.
6162
6263 Args:
6364 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
6466 post_search_filter: If enabled search results will be filtered to remove expired objects that have not yet been deleted.
6567 """
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
6672 return _ObjectTTLCreate (
6773 deleteOn = date_property ,
6874 postSearchFilter = post_search_filter ,
69- defaultTtl = None ,
75+ defaultTtl = time_to_live_after_date ,
7076 )
0 commit comments