Skip to content

Commit 0f83d78

Browse files
authored
Merge pull request #11494 from GlobalDataverseCommunityConsortium/indexing_fixes
Full-text Indexing Fixes
2 parents 7eff2a5 + 5e6d1a7 commit 0f83d78

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/main/java/edu/harvard/iq/dataverse/dataaccess/GlobusOverlayAccessIO.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ public long retrieveSizeFromMedia() {
240240
public InputStream getInputStream() throws IOException {
241241
//Currently only supported when using an S3 store with the Globus S3Connector.
242242
//ToDo: Support when using a managed Globus endpoint that supports http access
243-
if(StorageIO.isDataverseAccessible(endpoint)) {
243+
if(isDataverseAccessible(driverId)) {
244244
return baseStore.getInputStream();
245245
} else {
246-
throw new IOException("Not implemented");
246+
return null;
247247
}
248248
}
249249

@@ -504,5 +504,10 @@ public void saveInputStream(InputStream inputStream, Long filesize) throws IOExc
504504
throw new UnsupportedDataAccessOperationException(
505505
this.getClass().getName() + ": savePath() not implemented in this storage driver.");
506506
}
507+
508+
@Override
509+
public boolean isDataverseAccessible() {
510+
return isDataverseAccessible(this.driverId);
511+
}
507512

508513
}

src/main/java/edu/harvard/iq/dataverse/dataaccess/StorageIO.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,10 @@ protected String getConfigParam(String parameterName, String defaultValue) {
671671
return getConfigParamForDriver(this.driverId, parameterName, defaultValue);
672672
}
673673

674+
public boolean isDataverseAccessible() {
675+
return true;
676+
}
677+
674678
protected static String getConfigParamForDriver(String driverId, String parameterName) {
675679
return getConfigParamForDriver(driverId, parameterName, null);
676680
}
@@ -681,5 +685,4 @@ protected static String getConfigParamForDriver(String driverId, String paramete
681685
public static String getNewIdentifier(String driverId) {
682686
return driverId + DataAccess.SEPARATOR + FileUtil.generateStorageIdentifier();
683687
}
684-
685688
}

src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,7 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
14591459
String datasetPersistentURL = dataset.getPersistentURL();
14601460
boolean isHarvested = dataset.isHarvested();
14611461
long startTime = System.currentTimeMillis();
1462+
LocalDate now = LocalDate.now();
14621463
fileMetadatas.stream().forEach(fileMetadata -> {
14631464
DataFile datafile = fileMetadata.getDataFile();
14641465
Embargo emb = datafile.getEmbargo();
@@ -1499,8 +1500,10 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
14991500
datafileSolrInputDocument.addField(SearchFields.PERSISTENT_URL, datasetPersistentURL);
15001501
datafileSolrInputDocument.addField(SearchFields.TYPE, "files");
15011502
datafileSolrInputDocument.addField(SearchFields.CATEGORY_OF_DATAVERSE, dvIndexableCategoryName);
1503+
boolean embargoed = false;
15021504
if (end != null) {
15031505
datafileSolrInputDocument.addField(SearchFields.EMBARGO_END_DATE, end.toEpochDay());
1506+
embargoed = end.isAfter(now);
15041507
}
15051508
if (start != null) {
15061509
datafileSolrInputDocument.addField(SearchFields.RETENTION_END_DATE, start.toEpochDay());
@@ -1511,14 +1514,15 @@ public SolrInputDocuments toSolrDocs(IndexableDataset indexableDataset, Set<Long
15111514
if (!isHarvested && !datafile.isRestricted()
15121515
&& !datafile.isFilePackage()
15131516
&& fileSize != 0 && fileSize <= maxSize
1514-
&& datafile.getRetention() == null) {
1517+
&& datafile.getRetention() == null
1518+
&& !embargoed) {
15151519
StorageIO<DataFile> accessObject = null;
15161520
InputStream instream = null;
15171521
ContentHandler textHandler = null;
15181522
try {
15191523
accessObject = DataAccess.getStorageIO(datafile,
15201524
new DataAccessRequest());
1521-
if (accessObject != null) {
1525+
if (accessObject != null && accessObject.isDataverseAccessible()) {
15221526
accessObject.open();
15231527
// If the size is >max, we don't use the stream. However, for S3, the stream is
15241528
// currently opened in the call above (see

0 commit comments

Comments
 (0)