@@ -38,15 +38,6 @@ def _validate_non_negative_int(name: str, value: int | None) -> None:
3838 raise ValueError (f"{ name } must be zero or positive." )
3939
4040
41- def _validate_sample_rate (sample_rate : float | None ) -> None :
42- if sample_rate is None :
43- return
44- if isinstance (sample_rate , bool ) or not isinstance (sample_rate , int | float ):
45- raise TypeError ("sample_rate must be a float between 0.0 and 1.0." )
46- if sample_rate < 0 or sample_rate > 1 :
47- raise ValueError ("sample_rate must be between 0.0 and 1.0." )
48-
49-
5041class Score (Func ):
5142 """BM25 score annotation."""
5243
@@ -100,19 +91,9 @@ def as_sql( # type: ignore[override]
10091
10192
10293class Snippets (Func ):
103- """Multiple-snippets annotation.
104-
105- Wraps ``pdb.snippets(column, ...)`` which returns a text array of all
106- matching snippet fragments, with named SQL parameters.
107-
108- See: https://docs.paradedb.com/documentation/full-text/highlight#multiple-snippets
109- """
110-
11194 function = FN_SNIPPETS
11295 output_field = ArrayField (base_field = CharField ())
11396
114- _VALID_SORT_BY = ("score" , "position" )
115-
11697 def __init__ (
11798 self ,
11899 field : str ,
@@ -124,10 +105,6 @@ def __init__(
124105 offset : int | None = None ,
125106 sort_by : Literal ["score" , "position" ] | None = None ,
126107 ) -> None :
127- if sort_by is not None and sort_by not in self ._VALID_SORT_BY :
128- raise ValueError (
129- f"sort_by must be one of { self ._VALID_SORT_BY !r} , got { sort_by !r} "
130- )
131108 _validate_non_negative_int ("max_num_chars" , max_num_chars )
132109 _validate_non_negative_int ("limit" , limit )
133110 _validate_non_negative_int ("offset" , offset )
@@ -320,7 +297,6 @@ def paradedb_verify_index(
320297 using : str = DEFAULT_DB_ALIAS ,
321298) -> list [dict [str , Any ]]:
322299 """Run ``pdb.verify_index()`` for one BM25 index."""
323- _validate_sample_rate (sample_rate )
324300 sql = [f"SELECT * FROM { FN_VERIFY_INDEX } (%s::regclass" ]
325301 params : list [Any ] = [index ]
326302 if heapallindexed :
@@ -356,7 +332,6 @@ def paradedb_verify_all_indexes(
356332 using : str = DEFAULT_DB_ALIAS ,
357333) -> list [dict [str , Any ]]:
358334 """Run ``pdb.verify_all_indexes()`` across BM25 indexes."""
359- _validate_sample_rate (sample_rate )
360335 sql = [f"SELECT * FROM { FN_VERIFY_ALL_INDEXES } (" ]
361336 params : list [Any ] = []
362337 named_params : list [tuple [str , str , Any ]] = []
0 commit comments