@@ -1939,7 +1939,7 @@ def get_remote_sheriff_order(self, node_name: str, id: str) -> types.SheriffOrde
19391939 )
19401940 return types .SheriffOrderInfo .from_json (data )
19411941
1942- def search_nodes (self , query : str | None = None , limit : int | None = None ) -> List [ types .SearchNodeInfo ] :
1942+ def search_nodes (self , filter : types . SearchNodeFilter ) -> types .SearchNodePageInfo :
19431943 """
19441944 Search for Moera nodes matching the search ``query``. Every space-delimited word in the query must match
19451945 case-insensitively a beginning of the node's name or a beginning of any non-letter-delimited word in the node's
@@ -1950,13 +1950,36 @@ def search_nodes(self, query: str | None = None, limit: int | None = None) -> Li
19501950 The returned nodes are sorted by their relevance. The exact definition of this term is left to the search
19511951 engine's implementation.
19521952
1953+ :param filter:
1954+ """
1955+ location = "/search/nodes"
1956+ data = self .call (
1957+ "search_nodes" , location , method = "POST" , body = filter , schema = schemas .SEARCH_NODE_PAGE_INFO_SCHEMA
1958+ )
1959+ return types .SearchNodePageInfo .from_json (data )
1960+
1961+ def search_node_suggestions (
1962+ self , query : str | None = None , sheriff : str | None = None , limit : int | None = None
1963+ ) -> List [types .SearchNodeInfo ]:
1964+ """
1965+ Search for Moera nodes matching the search ``query`` and return a short list of "smart suggestions" for the
1966+ user. Every space-delimited word in the query must match case-insensitively a beginning of the node's name or a
1967+ beginning of any non-letter-delimited word in the node's full name. The order of words is not significant.
1968+
1969+ The search engine may decide to return fewer nodes than the given ``limit``.
1970+
1971+ The returned nodes are sorted by their relevance. The exact definition of this term is left to the search
1972+ engine's implementation.
1973+
19531974 :param query: the search query
1975+ :param sheriff: filter out entries prohibited by the given sheriff
19541976 :param limit: maximum number of nodes returned
19551977 """
1956- location = "/search/nodes" .format ()
1957- params = {"query" : query , "limit" : limit }
1978+ location = "/search/nodes/suggestions " .format ()
1979+ params = {"query" : query , "sheriff" : sheriff , " limit" : limit }
19581980 data = self .call (
1959- "search_nodes" , location , method = "GET" , params = params , schema = schemas .SEARCH_NODE_INFO_ARRAY_SCHEMA
1981+ "search_node_suggestions" , location , method = "GET" , params = params ,
1982+ schema = schemas .SEARCH_NODE_INFO_ARRAY_SCHEMA
19601983 )
19611984 return structure_list (data , types .SearchNodeInfo )
19621985
0 commit comments