[docs]classExhaustiveParameters(Parameters):"""Parameters for an exhaustive search. """
[docs]def__init__(self,distance:Literal["Euclidean","Manhattan","Cosine"]="Euclidean",):""" Args: distance: Distance metric for index construction and search. """self.distance=distance
@propertydefdistance(self)->str:"""Distance metric, see :meth:`~__init__()`."""returnself._distance@distance.setterdefdistance(self,distance:str):""" Args: distance: Distance metric, see :meth:`~__init__()`. """ifdistancenotin["Euclidean","Manhattan","Cosine"]:raiseValueError("unsupported 'distance'")self._distance=distance
[docs]classExhaustiveIndex(GenericIndex):"""A prebuilt index for an exhaustive search, created by :py:func:`~knncolle.define_builder.define_builder` with a :py:class:`~knncolle.exhaustive.ExhaustiveParameters` instance."""
[docs]def__init__(self,ptr):""" Args: ptr: Address of a ``knncolle_py::WrappedPrebuilt`` containing an exhaustive search index, allocated in C++. """super().__init__(ptr)