Nominatim does much, much more than a simple query of the tags. It analyzes the data with spatial queries (PostgreSQL/PostGIS) and determines in which polygon (country, state, country, zip code area, …) this object is located. And if such a polygon is not available (like zip code areas in many countries), it will try other algorithms.
This is not so easy with the raw data - nothing else you use.
Solution: Create a PostgreSQL/PostGIS database, fill it with raw data using osm2pgsql or osmconvert, and start your own queries.
Or: Install a local instance of nominatim on your servers and use that. (*)
*) which requires installation of PostgreSQL/PostGIS and loading data with osm2pgsql.