mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Remove unused kwargs in yacy, update comments.
This commit is contained in:
parent
f9b9217e98
commit
ea16426a8d
@ -17,24 +17,19 @@ def search_yacy(
|
|||||||
query: str,
|
query: str,
|
||||||
count: int,
|
count: int,
|
||||||
filter_list: Optional[list[str]] = None,
|
filter_list: Optional[list[str]] = None,
|
||||||
**kwargs,
|
|
||||||
) -> list[SearchResult]:
|
) -> list[SearchResult]:
|
||||||
"""
|
"""
|
||||||
Search a Yacy instance for a given query and return the results as a list of SearchResult objects.
|
Search a Yacy instance for a given query and return the results as a list of SearchResult objects.
|
||||||
|
|
||||||
The function allows passing additional parameters such as language or time_range to tailor the search result.
|
The function accepts username and password for authenticating to Yacy.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query_url (str): The base URL of the Yacy server.
|
query_url (str): The base URL of the Yacy server.
|
||||||
|
username (str): Optional YaCy username.
|
||||||
|
password (str): Optional YaCy password.
|
||||||
query (str): The search term or question to find in the Yacy database.
|
query (str): The search term or question to find in the Yacy database.
|
||||||
count (int): The maximum number of results to retrieve from the search.
|
count (int): The maximum number of results to retrieve from the search.
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
language (str): Language filter for the search results; e.g., "en-US". Defaults to an empty string.
|
|
||||||
safesearch (int): Safe search filter for safer web results; 0 = off, 1 = moderate, 2 = strict. Defaults to 1 (moderate).
|
|
||||||
time_range (str): Time range for filtering results by date; e.g., "2023-04-05..today" or "all-time". Defaults to ''.
|
|
||||||
categories: (Optional[list[str]]): Specific categories within which the search should be performed, defaulting to an empty string if not provided.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list[SearchResult]: A list of SearchResults sorted by relevance score in descending order.
|
list[SearchResult]: A list of SearchResults sorted by relevance score in descending order.
|
||||||
|
|
||||||
@ -42,12 +37,6 @@ def search_yacy(
|
|||||||
requests.exceptions.RequestException: If a request error occurs during the search process.
|
requests.exceptions.RequestException: If a request error occurs during the search process.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Default values for optional parameters are provided as empty strings or None when not specified.
|
|
||||||
language = kwargs.get("language", "en-US")
|
|
||||||
safesearch = kwargs.get("safesearch", "1")
|
|
||||||
time_range = kwargs.get("time_range", "")
|
|
||||||
categories = "".join(kwargs.get("categories", []))
|
|
||||||
|
|
||||||
# Use authentication if either username or password is set
|
# Use authentication if either username or password is set
|
||||||
yacy_auth = None
|
yacy_auth = None
|
||||||
if username or password:
|
if username or password:
|
||||||
@ -59,14 +48,6 @@ def search_yacy(
|
|||||||
"resource": "global",
|
"resource": "global",
|
||||||
"maximumRecords": count,
|
"maximumRecords": count,
|
||||||
"nav": "none",
|
"nav": "none",
|
||||||
# "format": "json",
|
|
||||||
# "pageno": 1,
|
|
||||||
# "safesearch": safesearch,
|
|
||||||
# "language": language,
|
|
||||||
# "time_range": time_range,
|
|
||||||
# "categories": categories,
|
|
||||||
# "theme": "simple",
|
|
||||||
# "image_proxy": 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if provided a json API URL
|
# Check if provided a json API URL
|
||||||
|
Loading…
Reference in New Issue
Block a user