leonhard-s / auraxium

A high-level Python wrapper for the PlanetSide 2 API.
https://auraxium.readthedocs.io/
MIT License
28 stars 8 forks source link

Client.get_by_name not using name.first_lower #61

Closed yakMM closed 1 year ago

yakMM commented 1 year ago

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

leonhard-s commented 1 year ago

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.

yakMM commented 1 year ago

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

leonhard-s commented 1 year ago

Fixed in 0.2.3.