@@ -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