Skip to content

Commit

Permalink
Merge pull request DSpace#9057 from DSpace/backport-8948-to-main
Browse files Browse the repository at this point in the history
[Port main] Add a configuration key to disable hierarchical browse indexes
  • Loading branch information
tdonohue authored Sep 8, 2023
2 parents 77919e1 + 06f4d8d commit 375f902
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.app.util.DCInput;
Expand Down Expand Up @@ -557,6 +558,15 @@ public DSpaceControlledVocabularyIndex getVocabularyIndex(String nameVocab) {
init();
ChoiceAuthority source = this.getChoiceAuthorityByAuthorityName(nameVocab);
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<>();
Map<String, List<String>> formsToFields = this.authoritiesFormDefinitions.get(nameVocab);
for (Map.Entry<String, List<String>> formToField : formsToFields.entrySet()) {
Expand Down
6 changes: 6 additions & 0 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,12 @@ webui.browse.index.4 = subject:metadata:dc.subject.*:text
## example of authority-controlled browse category - see authority control config
#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.
# (Requires reboot of servlet container, e.g. Tomcat, to reload)
# webui.browse.vocabularies.disabled = srsc

# Enable/Disable tag cloud in browsing.
# webui.browse.index.tagcloud.<n> = true | false
# where n is the index number from the above options
Expand Down

0 comments on commit 375f902

Please sign in to comment.