Dan,
In _aggegation.php, even though I said that I wasn't going to investigate whether the "languages" threshold on line 1 ought to be changed from 3 to 2, I did anyway. What I discovered was that no, 3 is correct.
The change that you made, inspired by Monica Wood's version at
https://groups.google.com/g/ica-atom-users/c/134crsm9gEs, does exactly what is desired: display a language list only if it contains something useful in narrowing the search. If the only things on the list simply restate the original search results, then there can be no narrowing, so displaying the list is pointless.
The unique aspect of the Language facet list is that it always starts out with two items containing the original description count: "Unique records," plus "English" or whatever the default language is. In neither case would the number narrow the search, so the test for displaying a language list boils down to whether it contains more than 2 items.
The other facet lists are different: They do not start out with two unnecessary items, and all such items narrow the result in some way. So the test for displaying these lists can be simply whether they contain any items.
Given these facts, it follows that in the current (2.6.4) release, the language facet behavior is in fact NOT in alignment
with the other facet behaviors: A language list is displayed if it contains at least one item more than the default. The other lists are not displayed unless they contain at least two items more than the default. Why?
In fact, prior to the AtoM 2.3 release, the threshold for non-language facet list display was apparently one item, not two. These are the first few lines of
_aggegation.php from the Git "stable 2.2.x" release of Jan 22, 2015:
<?php if (isset($sf_request->$facet) || (isset($open) && $open
&& isset($pager->facets[$facet]) && 0 < count($pager->facets[$facet]['terms']))): ?>
<section class="facet open">
<?php else: ?>
<section class="facet">
<?php endif; ?>
In the "stable 2.3.x " release of Dec 11, 2015, this became:
<?php if (isset($pager->facets[$facet]) && (isset($filters[$facet])
|| count($pager->facets[$facet]['terms']) > 1)): ?>
<?php if (isset($sf_request->$facet) || (isset($open) && $open
&& 0 < count($pager->facets[$facet]['terms']))): ?>
<section class="facet open">
<?php else: ?>
<section class="facet">
<?php endif; ?>
Note that the count() test changed from 0 to 1. This change appeared as part of commit 4a947c9 on Nov 15, 2015. This was a big set of changes described as "Merge IO browse and adv. search pages, refs #9141." The commit comments include this line:
- Don't show facets with only one item unless it's selected
When I described my patch for displaying genre facet lists even when they contained only one item, I meant to add that this fixed not only genre, but also subjects, places, names, etc.
One way to demonstrate the current (peculiar) display of facets like subjects and places is at the AtoM
demo installation,
https://demo.accesstomemory.org. Log in, browse Archival descriptions, then in the Level of Description facet list, click on Series. This should generate a single result: the Jim Heldmann fonds. The Subject facet should now show two items: Children and youth, and Education. If you edit the archival description and delete the Education access point, then after you save the change, the Subject facet disappears. What happened to those poor Children and youth? Aren't they still worth mentioning?
-Scott Breeden