2525from meilisearch .errors import version_error_hint_message
2626from meilisearch .models .document import Document , DocumentsResults
2727from meilisearch .models .embedders import (
28+ CompositeEmbedder ,
2829 Embedders ,
2930 EmbedderType ,
3031 HuggingFaceEmbedder ,
3839 IndexStats ,
3940 LocalizedAttributes ,
4041 Pagination ,
42+ PrefixSearch ,
4143 ProximityPrecision ,
4244 TypoTolerance ,
4345)
@@ -977,6 +979,8 @@ def get_settings(self) -> Dict[str, Any]:
977979 embedders [k ] = HuggingFaceEmbedder (** v )
978980 elif v .get ("source" ) == "rest" :
979981 embedders [k ] = RestEmbedder (** v )
982+ elif v .get ("source" ) == "composite" :
983+ embedders [k ] = CompositeEmbedder (** v )
980984 else :
981985 embedders [k ] = UserProvidedEmbedder (** v )
982986
@@ -1662,6 +1666,57 @@ def reset_pagination_settings(self) -> TaskInfo:
16621666
16631667 return TaskInfo (** task )
16641668
1669+ def get_facet_search_settings (self ) -> bool :
1670+ """Get the facet search settings of an index.
1671+
1672+ Returns
1673+ -------
1674+ bool:
1675+ True if facet search is enabled, False if disabled.
1676+ Raises
1677+ ------
1678+ MeilisearchApiError
1679+ An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
1680+ """
1681+
1682+ return self .http .get (self .__settings_url_for (self .config .paths .facet_search ))
1683+
1684+ def update_facet_search_settings (self , body : Union [bool , None ]) -> TaskInfo :
1685+ """Update the facet search settings of the index.
1686+
1687+ Parameters
1688+ ----------
1689+ body: bool
1690+ True to enable facet search, False to disable it.
1691+
1692+ Returns
1693+ -------
1694+ task_info:
1695+ TaskInfo instance containing information about a task to track the progress of an asynchronous process.
1696+ https://www.meilisearch.com/docs/reference/api/tasks#get-one-task
1697+
1698+ Raises
1699+ ------
1700+ MeilisearchApiError
1701+ An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
1702+ """
1703+ task = self .http .put (self .__settings_url_for (self .config .paths .facet_search ), body = body )
1704+
1705+ return TaskInfo (** task )
1706+
1707+ def reset_facet_search_settings (self ) -> TaskInfo :
1708+ """Reset facet search settings of the index to default values.
1709+
1710+ Returns
1711+ -------
1712+ task_info:
1713+ TaskInfo instance containing information about a task to track the progress of an asynchronous process.
1714+ https://www.meilisearch.com/docs/reference/api/tasks
1715+ """
1716+ task = self .http .delete (self .__settings_url_for (self .config .paths .facet_search ))
1717+
1718+ return TaskInfo (** task )
1719+
16651720 def get_faceting_settings (self ) -> Faceting :
16661721 """Get the faceting settings of an index.
16671722
@@ -1675,7 +1730,6 @@ def get_faceting_settings(self) -> Faceting:
16751730 MeilisearchApiError
16761731 An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
16771732 """
1678-
16791733 faceting = self .http .get (self .__settings_url_for (self .config .paths .faceting ))
16801734
16811735 return Faceting (** faceting )
@@ -1934,6 +1988,8 @@ def get_embedders(self) -> Embedders | None:
19341988 embedders [k ] = OllamaEmbedder (** v )
19351989 elif source == "rest" :
19361990 embedders [k ] = RestEmbedder (** v )
1991+ elif source == "composite" :
1992+ embedders [k ] = CompositeEmbedder (** v )
19371993 elif source == "userProvided" :
19381994 embedders [k ] = UserProvidedEmbedder (** v )
19391995 else :
@@ -1977,6 +2033,8 @@ def update_embedders(self, body: Union[MutableMapping[str, Any], None]) -> TaskI
19772033 embedders [k ] = OllamaEmbedder (** v )
19782034 elif source == "rest" :
19792035 embedders [k ] = RestEmbedder (** v )
2036+ elif source == "composite" :
2037+ embedders [k ] = CompositeEmbedder (** v )
19802038 elif source == "userProvided" :
19812039 embedders [k ] = UserProvidedEmbedder (** v )
19822040 else :
@@ -2071,6 +2129,58 @@ def reset_search_cutoff_ms(self) -> TaskInfo:
20712129
20722130 return TaskInfo (** task )
20732131
2132+ # PREFIX SEARCH
2133+
2134+ def get_prefix_search (self ) -> PrefixSearch :
2135+ """Get the prefix search settings of an index.
2136+
2137+ Returns
2138+ -------
2139+ settings:
2140+ The prefix search settings of the index.
2141+
2142+ Raises
2143+ ------
2144+ MeilisearchApiError
2145+ An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
2146+ """
2147+ prefix_search = self .http .get (self .__settings_url_for (self .config .paths .prefix_search ))
2148+
2149+ return PrefixSearch [to_snake (prefix_search ).upper ()]
2150+
2151+ def update_prefix_search (self , body : Union [PrefixSearch , None ]) -> TaskInfo :
2152+ """Update the prefix search settings of the index.
2153+
2154+ Parameters
2155+ ----------
2156+ body:
2157+ Prefix search settings
2158+
2159+ Returns
2160+ -------
2161+ task_info:
2162+ TaskInfo instance containing information about a task to track the progress of an asynchronous process.
2163+ https://www.meilisearch.com/docs/reference/api/tasks
2164+ """
2165+ task = self .http .put (self .__settings_url_for (self .config .paths .prefix_search ), body )
2166+
2167+ return TaskInfo (** task )
2168+
2169+ def reset_prefix_search (self ) -> TaskInfo :
2170+ """Reset the prefix search settings of the index
2171+
2172+ Returns
2173+ -------
2174+ task_info:
2175+ TaskInfo instance containing information about a task to track the progress of an asynchronous process.
2176+ https://www.meilisearch.com/docs/reference/api/tasks
2177+ """
2178+ task = self .http .delete (
2179+ self .__settings_url_for (self .config .paths .prefix_search ),
2180+ )
2181+
2182+ return TaskInfo (** task )
2183+
20742184 # PROXIMITY PRECISION SETTINGS
20752185
20762186 def get_proximity_precision (self ) -> ProximityPrecision :
0 commit comments