The current search API needs performance improvements and better logging/error handling for easier troubleshooting.
Right now, it appears to use the "retrieval test" logic, which unnecessarily saves a record to the database for every search query.
I suggest splitting it into two separate APIs:
- A core
search API: Focused on performance, without saving records to the database.
- A
retrieval_test API: Keeps the current behavior for testing purposes.
This change would significantly improve performance and make the API's purpose clearer.