Skip to content

Commit 95d98a9

Browse files
author
Max Burnette
committed
Fix recursion of dataset indexing of subfolders
1 parent b539960 commit 95d98a9

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

app/services/ElasticsearchPlugin.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,8 @@ class ElasticsearchPlugin(application: Application) extends Plugin {
437437
// Perform recursion first if necessary
438438
if (recursive) {
439439
files.get(dataset.files).found.foreach(f => index(f, idx))
440-
for (folderid <- dataset.folders) {
441-
folders.get(folderid) match {
442-
case Some(f) => {
443-
files.get(f.files).found.foreach(fi => index(fi, idx))
444-
}
445-
case None => Logger.error(s"Error getting file $folderid for recursive indexing")
446-
}
447-
}
440+
for (f <- folders.findByParentDatasetId(dataset.id))
441+
files.get(f.files).found.foreach(fi => index(fi, idx))
448442
}
449443
index(SearchUtils.getElasticsearchObject(dataset), idx.getOrElse(nameOfIndex))
450444
}

app/services/mongodb/MongoDBDatasetService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ class MongoDBDatasetService @Inject() (
14091409

14101410
def indexAll(idx: Option[String] = None) = {
14111411
// Bypass Salat in case any of the file records are malformed to continue past them
1412-
Dataset.dao.dataset.find(MongoDBObject(), MongoDBObject("_id" -> 1)).foreach(d => {
1412+
Dataset.dao.collection.find(MongoDBObject(), MongoDBObject("_id" -> 1)).foreach(d => {
14131413
index(new UUID(d.get("_id").toString), idx)
14141414
})
14151415
}

0 commit comments

Comments
 (0)