Indicia-Team/warehouse

Importer - "Lookup of existing records" option not correctly looking up existing records under certain circumstances

Opened this issue · 1 comments

There are problems with the importer and the use of the "Lookup of existing records" option when a supermodel is used.

The problem became apparent during an import which required a list of latin names in one column, then a list of Swedish names to be added as translations in another column.

If we then use the "Lookup of existing records" option in the importer we start running into difficulties.
For instance, when I used the "Species list and taxon name" option, this would cause very problematic results.

The problem is that the code does not work very well if supermodels are present.
In our example above, the importer model is taxa_taxon_list, but actually the field we are mapping to lookup existing names against is taxon:taxon.

When looking up existing records the importer needs to create a join to then taxa database table. This is not handled very well and at the moment relies on special cases built into the function "buildJoin" in the import.php file.
Previously this included a couple of special cases to handle external_key/search_code lookups, as a workaround a special case for taxon name has now been added.
However this code needs generalising so broken cases cannot occur.

Note that the code has been patched to handle using the Species Name and Species List option, but it is possible other failures may occur.
The Parent, Species Name and Species List option is untested at time of writing.