auraxium icon indicating copy to clipboard operation
auraxium copied to clipboard

Client.get_by_name not using name.first_lower

Open yakMM opened this issue 2 years ago • 2 comments

Hello,

For the character collection, is there a reason Client.get_by_name is using a query with case(False) on name.first instead of a simple query on name.first_lower:

https://github.com/leonhard-s/auraxium/blob/145470755c2136366ba6cfe7a9003eda3772ab6a/auraxium/_client.py#L197

While the docstring for case mentions that case-insensitive look-ups are significantly slower and should be avoided when possible, citing the character collection as an example? https://github.com/leonhard-s/auraxium/blob/145470755c2136366ba6cfe7a9003eda3772ab6a/auraxium/census/_query.py#L299

yakMM avatar Nov 01 '22 15:11 yakMM

Hi, thanks for the report - good catch.

The PS2 datatypes themselves had (now deprecated) overrides that would handle these optimizations, but these will be removed to remove redundancy and clean up the syntax. However, given that there already is a special case to handle the non-standard field name, replacing it with name.first_lower is a quick fix.

leonhard-s avatar Nov 04 '22 13:11 leonhard-s

Yes, I asked because it is already a special case, otherwise the argument of genericity would prevail

yakMM avatar Nov 04 '22 17:11 yakMM

Fixed in 0.2.3.

leonhard-s avatar Mar 05 '23 10:03 leonhard-s