FriedrichFroebel/cmanager

Unreliable duplicate search in some cases

Closed this issue · 0 comments

The duplicate search is unreliable in some cases as the results might differ when running it two times in a row.

This is caused by the OKAPI runtime cache. On the first run, the cache size and owner name are null. If there is a match, the details like the size and owner will be added to the geocache instance. When running the duplicate search again, the cached geocache instance (the OC cache) will be returned which corresponds to the enriched version as this is the same object which we have added the details to beforehand. Now the comparison might produce different results as the cache size and owner name are taken into account as well. One example for this behaviour is GC26VJD/OC2ED4.

We should therefore always feed the basic object into the geocache comparator when searching for duplicates. For this we might want to add a new method getBasicCopy (or similar) to the Geocache class which returns a basic copy of itself and use the result of this method for feeding it into the comparator. By doing this, we should always get the same results from the duplicate search when running it multiple times.

Especially the part with the cache size and the owner name are related to #25, but this definitely are two different issues we should tackle on its own for now.