Skip to content

Commit

Permalink
Merge pull request #4038 from IQSS/4036-getrealval
Browse files Browse the repository at this point in the history
change values sent to solr to be dataset field values instead of disp…
  • Loading branch information
kcondon authored Aug 9, 2017
2 parents 7e9a09d + 1b9ebf6 commit a1792ad
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
29 changes: 28 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetField.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ public String getCompoundDisplayValue() {
return returnString;
}

/**
* despite the name, this returns a list of display values; not a list of values
*/
public List<String> getValues() {
List<String> returnList = new ArrayList<>();
if (!datasetFieldValues.isEmpty()) {
Expand All @@ -287,9 +290,33 @@ public List<String> getValues() {
}
return returnList;
}
/**
* list of values (as opposed to display values).
* used for passing to solr for indexing
*/
public List<String> getValues_nondisplay()
{
List returnList = new ArrayList();
if (!datasetFieldValues.isEmpty()) {
for (DatasetFieldValue dsfv : datasetFieldValues) {
returnList.add(dsfv.getValue());
}
} else {
for (ControlledVocabularyValue cvv : controlledVocabularyValues) {
if (cvv != null && cvv.getStrValue() != null) {
returnList.add(cvv.getStrValue());
}
}
}
return returnList;
}

/**
* appears to be only used for sending info to solr; changed to return values
* instead of display values
*/
public List<String> getValuesWithoutNaValues() {
List<String> returnList = getValues();
List<String> returnList = getValues_nondisplay();
returnList.removeAll(Arrays.asList(NA_VALUE));
return returnList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,8 @@ public IndexResponse indexPermissionsForOneDvObject(DvObject dvObject) {

private void persistToSolr(Collection<SolrInputDocument> docs) throws SolrServerException, IOException {
if (docs.isEmpty()) {
/**
* @todo Throw an exception here? "DvObject id 9999 does not exist."
*/
logger.info("nothing to persist");
// This method is routinely called with an empty list of docs.
logger.fine("nothing to persist");
return;
}
logger.fine("persisting to Solr...");
Expand Down

0 comments on commit a1792ad

Please sign in to comment.