search

Search Entity by Current Version as well as Previous Version

A search function for a management software was supposed to be able to lookup a customers data by searching with their address. Addresses can change and if for example a customer moved and thus their address changed, it should still be possible to find said customer with their old address. This functionality was required for some other entities as well, so implementing it generally was favorable. Instead of explicitly modeling for every such entity that it can have multiple values over time, I used an extensions for the Hibernate persistence framework called Envers for auditing tables. Which effectively means that an update to any row in an audited table will automatically insert the old row in an extra table which contains all previous versions of the row. Now instead of just searching the address table with the current addresses, I could also search all previous address versions in the respective auditing table. Thus being able to find a customer by its old address.

Its true that ES is great for finding searching and we also use it. But I don't think thats a particular "challenge" per se.

Taggings:

Subscribe to search