Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/solr/9.3.0/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@

<!-- incomplete datasets issue 8822 -->
<field name="datasetValid" type="boolean" stored="true" indexed="true" multiValued="false"/>

<field name="fileCount" type="plong" stored="true" indexed="true" multiValued="false"/>

<!--
METADATA SCHEMA FIELDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,8 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
solrInputDocument.addField(SearchFields.DATASET_CITATION, datasetVersion.getCitation(false));
solrInputDocument.addField(SearchFields.DATASET_CITATION_HTML, datasetVersion.getCitation(true));

solrInputDocument.addField(SearchFields.FILE_COUNT, datasetVersion.getFileMetadatas().size());

if (datasetVersion.isInReview()) {
solrInputDocument.addField(SearchFields.PUBLICATION_STATUS, IN_REVIEW_STRING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,6 @@ more targeted results for just datasets. The format is YYYY (i.e.

public static final String DATASET_VALID = "datasetValid";

public static final String FILE_COUNT = "fileCount";

}
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ public SolrQueryResponse search(
String nameOfDataverse = (String) solrDocument.getFieldValue(SearchFields.DATAVERSE_NAME);
Long embargoEndDate = (Long) solrDocument.getFieldValue(SearchFields.EMBARGO_END_DATE);
Boolean datasetValid = (Boolean) solrDocument.getFieldValue(SearchFields.DATASET_VALID);
Long fileCount = (Long) solrDocument.getFieldValue(SearchFields.FILE_COUNT);

List<String> matchedFields = new ArrayList<>();
List<Highlight> highlights = new ArrayList<>();
Expand Down Expand Up @@ -479,6 +480,7 @@ public SolrQueryResponse search(
solrSearchResult.setDeaccessionReason(deaccessionReason);
solrSearchResult.setDvTree(dvTree);
solrSearchResult.setDatasetValid(datasetValid);
solrSearchResult.setFileCount(fileCount);

String originSource = (String) solrDocument.getFieldValue(SearchFields.METADATA_SOURCE);
if (IndexServiceBean.HARVESTED.equals(originSource)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public class SolrSearchResult {
private String dataverseAffiliation;
private String citation;
private String citationHtml;

/**
* Only Dataset can have a file count
*/
private Long fileCount;

/**
* Files and datasets might have a UNF. Dataverses don't.
*/
Expand Down Expand Up @@ -571,7 +577,7 @@ public JsonObjectBuilder json(boolean showRelevance, boolean showEntityIds, bool
subjects.add(subject);
}
nullSafeJsonBuilder.add("subjects", subjects);
nullSafeJsonBuilder.add("fileCount", dv.getFileMetadatas().size());
nullSafeJsonBuilder.add("fileCount", this.fileCount);
nullSafeJsonBuilder.add("versionId", dv.getId());
nullSafeJsonBuilder.add("versionState", dv.getVersionState().toString());
if (this.isPublishedState()) {
Expand Down Expand Up @@ -1268,4 +1274,12 @@ public void setDatasetValid(Boolean datasetValid) {
public boolean isValid() {
return datasetValid;
}

public Long getFileCount() {
return fileCount;
}

public void setFileCount(Long fileCount) {
this.fileCount = fileCount;
}
}