# `search`

The ISNI search API utilizes an XML-based protocol known as [Search/Retrieve via URL](https://en.wikipedia.org/wiki/Search/Retrieve_via_URL).

## Testing

Testing for this package is largely snapshot-based, and will collect XML files for various input values provided in the unit tests. The goal of this was to provide a wide variety of test cases without hammering ISNI's API unnecessarily. This has proven to be extremely useful for figuring out different payload shape variations in the development of the Zod schema.

## Quirks

There are some interesting quirks about the ISNI search API that are not especially well documented and are worth noting:

- If you don't specify that you want the `recordSchema` query parameter to be `"isni-b"` you will get odd obfuscated output.
- The query is a percent-encoded [Contextual Query Language](https://en.wikipedia.org/wiki/Contextual_Query_Language) CQL-formatted string.
- It looks like when there are multiple results returned with the same confidence value, the more accurate results come earlier in the array.
- So far there appears to be a "data confidence" value of `60` across the board for all search results. Best guess is that someone on the ISNI side hard-coded this and has a todo somewhere to implement a real confidence number.
