Add a configuration key to disable hierarchical browse indexes

This commit is contained in:
Toni Prieto
2023-07-10 11:29:33 +02:00
parent ea4565bd60
commit e55bc87c1a
2 changed files with 15 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dspace.app.util.DCInput; import org.dspace.app.util.DCInput;
@@ -557,6 +558,15 @@ public final class ChoiceAuthorityServiceImpl implements ChoiceAuthorityService
init(); init();
ChoiceAuthority source = this.getChoiceAuthorityByAuthorityName(nameVocab); ChoiceAuthority source = this.getChoiceAuthorityByAuthorityName(nameVocab);
if (source != null && source instanceof DSpaceControlledVocabulary) { if (source != null && source instanceof DSpaceControlledVocabulary) {
// First, check if this vocabulary index is disabled
String[] vocabulariesDisabled = configurationService
.getArrayProperty("webui.browse.vocabularies.disabled");
if (vocabulariesDisabled != null && ArrayUtils.contains(vocabulariesDisabled, nameVocab)) {
// Discard this vocabulary browse index
return null;
}
Set<String> metadataFields = new HashSet<>(); Set<String> metadataFields = new HashSet<>();
Map<String, List<String>> formsToFields = this.authoritiesFormDefinitions.get(nameVocab); Map<String, List<String>> formsToFields = this.authoritiesFormDefinitions.get(nameVocab);
for (Map.Entry<String, List<String>> formToField : formsToFields.entrySet()) { for (Map.Entry<String, List<String>> formToField : formsToFields.entrySet()) {

View File

@@ -1158,6 +1158,11 @@ webui.browse.index.4 = subject:metadata:dc.subject.*:text
## example of authority-controlled browse category - see authority control config ## example of authority-controlled browse category - see authority control config
#webui.browse.index.5 = lcAuthor:metadataAuthority:dc.contributor.author:authority #webui.browse.index.5 = lcAuthor:metadataAuthority:dc.contributor.author:authority
# By default, browse hierarchical indexes are created based on the used controlled
# vocabularies in the submission forms. These could be disabled adding the name of
# the vocabularies to exclude in this comma-separated property:
# webui.browse.vocabularies.disabled = srsc
# Enable/Disable tag cloud in browsing. # Enable/Disable tag cloud in browsing.
# webui.browse.index.tagcloud.<n> = true | false # webui.browse.index.tagcloud.<n> = true | false
# where n is the index number from the above options # where n is the index number from the above options