Skip to content

XIVAPIClient.index_search() raises XIVAPIError with any wildcard query #13

@Terlen

Description

@Terlen

Don't know if this repo is maintained anymore but thought I'd mention an error I ran into!

Passing any query to XIVAPIClient.index_search() with string_algo="wildcard" raises an XIVAPIError exception.

This occurs because the "wildcard" query type does not support the "query" parameter, as explained by the response.

{'Error': True, 
'Subject':` 'XIVAPI ERROR', 
'Note': 'Get on discord: https://discord.gg/MFFVHWC', 
'Message': 'Search Error: {
    "error":{
        "root_cause":[{
            "type":"parsing_exception",
            "reason":"[wildcard] query does not support [query]","line":1,"col":69
        }],
        "type":"parsing_exception",
        "reason":"[wildcard] query does not support [query]",
        "line":1,"col":69
    },
"status":400
}', 
'Hash': '61969353bd46e810ce74ee1177e0d79b0c1bf5f2', 
'Ex': 'App\\Common\\Exceptions\\SearchException', 
'ExCode': 500, 
'Url': '', 
'Debug': {
    'ID': 'Yn60aZfP21081602', 
    'File': '#55 xivapi.com/src/Controller/SearchController.php', 
    'Method': 'POST', 
    'Path': '/search', 
    'Action': 'App\\Controller\\SearchController::search', 
    'Code': 500, 
    'Date': '2021-08-16 14:10:10', 
    'Env': 'prod'
}
}`

This can be fixed by ensuring "wildcard" queries are constructed with the correct parameters like the following:

'wildcard': {
                NameCombined_en: {
                "value": name,
                "boost": 1.0,
                "rewrite": "constant_score"
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions