-
Notifications
You must be signed in to change notification settings - Fork 16
Search
xiv.search()
Search all static game content (not characters, FCs, etc). There are two ways to do this:
Simply use a string as the input to search for. All of the params detailed below apply with this method.
By passing an object instead of a string as the input, you can use XIVAPI's Advanced ElasticSearch query method for finer control over your searches. You can find more info on how to construct this object on the Advanced ElasticSearch Queries
section of the XIVAPI doc entry, and using the Search Playground. Note that using this method means that only a few of the entries in the param object will have an effect, as outlined below.
Parameter | Type | Methods | Description |
---|---|---|---|
lore | boolean | String & JSON | Only search using the lore endpoint. |
indexes | CSV* | String & JSON | Search a specific series of indexes. |
filters | CSV* | String | Search using a comma-separated list of filters. See more. |
columns | CSV* | String | Results will only contain specific data. See more. |
string_algo | string | String | Search algorithm to use for string matching. |
string_column | string | String | Column to use in string searches. |
sort_field | string | String | Field to sort results by. |
sort_order | string | String | Order the sort_field by a specific direction, either asc or desc . |
limit | int | String | Limit the number of results (1 to 100). |
*CSV: accepts either string (e.g.
'Achievement,Title,Action,CraftAction'
) or array (e.g.['Achievement', 'Title', 'Action', 'CraftAction']
)
See the Params section in the XIVAPI doc page for more on the different parameters, including possible values.
Returns: { Pagination, Results }
> let response = await xiv.search('kote', {snake_case: true})
{
pagination:
{ page: 1,
page_next: null,
page_prev: null,
page_total: 1,
results: 61,
results_per_page: 100,
results_total: 61 },
results:
[ { id: 17895,
icon: 'https://xivapi.com/i/020000/020830.png',
name: 'Kote Materials',
url: 'https://xivapi.com/Item/17895',
url_type: 'Item',
_: 'item',
_score: 1 },
{ id: 17896,
icon: 'https://xivapi.com/i/044000/044705.png',
name: 'Titanium Kote',
url: 'https://xivapi.com/Item/17896',
url_type: 'Item',
_: 'item',
_score: 1 }
...
}