Skip to content

Commit

Permalink
Merge pull request #8601 from GlobalDataverseCommunityConsortium/IQSS…
Browse files Browse the repository at this point in the history
…/8595-CVV_solr_updates

IQSS/8595 - update existing schema and code to make all cvv files multival in solr
  • Loading branch information
kcondon committed Apr 29, 2022
2 parents 2bbe76f + cbe1327 commit 7477e7a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conf/solr/8.11.1/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
<field name="grantNumber" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="grantNumberAgency" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="grantNumberValue" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="journalArticleType" type="text_en" multiValued="false" stored="true" indexed="true"/>
<field name="journalArticleType" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="journalIssue" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="journalPubDate" type="text_en" multiValued="true" stored="true" indexed="true"/>
<field name="journalVolume" type="text_en" multiValued="true" stored="true" indexed="true"/>
Expand Down
3 changes: 3 additions & 0 deletions doc/release-notes/8595-cvv-field-solr-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Controlled vocabulary fields that do not allow multiple entries are not indexed properly in Dataverse instances configured to support multiple languages. This release fixes the schema.xml file for the one field affected in the standard metadata blocks (journalArticleType) and updates the api/admin/index/solr/schema to provide the correct information for use with the update-fields.sh script described in the [Metadata Customization section of the Admin Guide](https://guides.dataverse.org/en/latest/admin/metadatacustomization.html#updating-the-solr-schema).

The release should include updating the schema.xml file for solr or running the update-fields.sh script and reindexing (whatever standard instructions we give for schema changes.)
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public SolrField getSolrField() {

boolean makeSolrFieldMultivalued;
// http://stackoverflow.com/questions/5800762/what-is-the-use-of-multivalued-field-type-in-solr
if (allowMultiples || parentAllowsMultiplesBoolean) {
if (allowMultiples || parentAllowsMultiplesBoolean || isControlledVocabulary()) {
makeSolrFieldMultivalued = true;
} else {
makeSolrFieldMultivalued = false;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ public String getSolrSchema() {
StringBuilder sb = new StringBuilder();

for (DatasetFieldType datasetField : datasetFieldService.findAllOrderedByName()) {
//ToDo - getSolrField() creates/returns a new object - just get it once and re-use
String nameSearchable = datasetField.getSolrField().getNameSearchable();
SolrField.SolrType solrType = datasetField.getSolrField().getSolrType();
String type = solrType.getType();
Expand Down Expand Up @@ -490,7 +491,7 @@ public String getSolrSchema() {
}

sb.append("---\n");

//ToDo - this is the same for loop as above - could combine into one by using a second string buffer and appending the latter one after the loop.
for (DatasetFieldType datasetField : datasetFieldService.findAllOrderedByName()) {
String nameSearchable = datasetField.getSolrField().getNameSearchable();
String nameFacetable = datasetField.getSolrField().getNameFacetable();
Expand Down

0 comments on commit 7477e7a

Please sign in to comment.