I may have found the cause of the problem, but maybe that mistake I did uncovered bugs from AtoM anyway.
I
noticed that archival descriptions created by hand still get properly
listed and searchable after I clear and rebuild cache. That may
indicates the problem is in the way the data is stored, so maybe in the
way I generate the EAD xml files. I wrote the EAD generator by looking
at what AtoM produces, but I now see that what AtoM produces can change
given this or that situation.
For example if the current display language is French, an EAD file produced by AtoM will contain this XML data:
<langusage><language langcode="fre">fr_FR</language></langusage>
But
if the current display language is English, an EAD file produced by
AtoM for the exact same archival description will contain this XML data
instead (even if the archival description is written in French):
<langusage><language langcode="eng">English</language></langusage>
First,
we see the language not being the one of the archival description. Then
we see that when it's said to be French, an iso code is used (fr_FR)
but if it's said to be English (that may be wrong), a vernacular name is
used (English). Also it may be possible that in some case it may write
“français” instead of “fr_FR” since that's what I produced while trying
to reproduce what AtoM produces.
In the EAD xml files I generated (and imported), the line was written this way:
<langusage><language>français</language></langusage>
The
language name is a vernacular name and not an ISO code, and It misses
the “langcode” attribute. The lack of “langcode“ attribute is maybe a
mistake of mine, but the use of a vernacular name is maybe just a copy
paste.
So I modified the EAD file previously quoted to modify the langusage data this way:
<langusage><language langcode="fre">fr_FR</language></langusage>
And
imported this modified EAD file using the bulk importer, then cleared
cache and repopulated it, and now the archival description is properly
listed (see screenshot) and searchable. You can find the EAD file that seems to work attached.
So, I'll try to regenerate all the EAD files and revert the database to before the bulk import and reimport all of them again. I'll keep you updated.
If there are AtoM actions to prune records without having to go the SQL way I would appreciate.
All in all, it looks like the EAD files produced by AtoM may reveal some AtoM bug.