Fix documentation formatting for get_search_suggestions.
This commit is contained in:
parent
7a4abd81a4
commit
3d88e75ea5
1 changed files with 52 additions and 60 deletions
|
|
@ -216,7 +216,9 @@ class SearchMixin:
|
||||||
|
|
||||||
return search_results
|
return search_results
|
||||||
|
|
||||||
def get_search_suggestions(self, query: str, detailed_runs=False) -> Union[List, List[Dict]]:
|
def get_search_suggestions(self,
|
||||||
|
query: str,
|
||||||
|
detailed_runs=False) -> Union[List[str], List[Dict]]:
|
||||||
"""
|
"""
|
||||||
Get Search Suggestions
|
Get Search Suggestions
|
||||||
|
|
||||||
|
|
@ -226,66 +228,56 @@ class SearchMixin:
|
||||||
suggestion along with the complete text (like many search services
|
suggestion along with the complete text (like many search services
|
||||||
usually bold the text typed by the user).
|
usually bold the text typed by the user).
|
||||||
Default: False, returns the list of search suggestions in plain text.
|
Default: False, returns the list of search suggestions in plain text.
|
||||||
:return: List of search suggestion results depending on detailed_runs param.
|
:return: List of search suggestion results depending on ``detailed_runs`` param.
|
||||||
Examples:
|
|
||||||
1.
|
Example response when ``query`` is 'fade' and ``detailed_runs`` is set to ``False``::
|
||||||
Params:
|
|
||||||
query = 'fade'
|
|
||||||
detailed_runs = False
|
|
||||||
|
|
||||||
Response:
|
|
||||||
[
|
[
|
||||||
'faded',
|
"faded",
|
||||||
'faded alan walker lyrics',
|
"faded alan walker lyrics",
|
||||||
'faded alan walker',
|
"faded alan walker",
|
||||||
'faded remix',
|
"faded remix",
|
||||||
'faded song',
|
"faded song",
|
||||||
'faded lyrics',
|
"faded lyrics",
|
||||||
'faded instrumental'
|
"faded instrumental"
|
||||||
]
|
]
|
||||||
|
|
||||||
2.
|
Example response when ``detailed_runs`` is set to ``True``::
|
||||||
Params:
|
|
||||||
query = 'fade'
|
|
||||||
detailed_runs = True
|
|
||||||
|
|
||||||
Response:
|
|
||||||
Runs with bold: True show the text typed by user & other runs contain the remaining suggestion.
|
|
||||||
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
'text': 'faded',
|
"text": "faded",
|
||||||
'runs': [
|
"runs": [
|
||||||
{
|
{
|
||||||
'text': 'fade',
|
"text": "fade",
|
||||||
'bold': True
|
"bold": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'text': 'd'
|
"text": "d"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'text': 'faded alan walker lyrics',
|
"text": "faded alan walker lyrics",
|
||||||
'runs': [
|
"runs": [
|
||||||
{
|
{
|
||||||
'text': 'fade',
|
"text": "fade",
|
||||||
'bold': True
|
"bold": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'text': 'd alan walker lyrics'
|
"text": "d alan walker lyrics"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'text': 'faded alan walker',
|
"text": "faded alan walker",
|
||||||
'runs': [
|
"runs": [
|
||||||
{
|
{
|
||||||
'text': 'fade',
|
"text": "fade",
|
||||||
'bold': True
|
"bold": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'text': 'd alan walker'
|
"text": "d alan walker"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue