Firstly, if this was operating in a real situation, you'd obviously have the luxury of designing data structures to enhance performance.

At the very least, metrics could be maintained as records were added / edited / deleted, distributing the workload and making delivery of results easier.

The addition of specialised dictionaries would markedly improve performance and also improve the quality of results.


Caching

Perhaps we could also implement query caching in the database as this kind of data is relatively stable and not subject to high frequency updating.

Additionally, we could utilise memory caching to make the most efficient use of each database query and reduce the overall number of queries.

If we really wanted it to pop along, then giving it its own, or a scalable server could really make a difference.


Language

The search could easily be made to operate in a multilingual mode, but might be of limited value in this type of data application.

However, the capacity of the code to simulate understanding of context within the queries could be introduced to the point of dealing with concepts like:

  • near / around / close to
  • preferably / ideally / if possible
  • not in / excluding / outside
  • etc