Skip to content

Commit 73c135c

Browse files
author
Max Burnette
committed
simplify file parent indexing
1 parent 95d98a9 commit 73c135c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

app/util/SearchUtils.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,16 @@ object SearchUtils {
2626

2727
// Get child_of relationships for File
2828
var child_of: ListBuffer[String] = ListBuffer()
29-
datasets.findByFileIdDirectlyContain(id).map(ds => {
29+
// ...first, the dataset which contains the file or its folder
30+
datasets.findByFileIdAllContain(id).map(ds => {
3031
child_of += ds.id.toString
3132
ds.spaces.map(spid => child_of += spid.toString)
3233
ds.collections.map(collid => child_of += collid.toString)
3334
})
34-
val folderlist = folders.findByFileId(id).map(fld => {
35+
// ...second, the immediate parent folder ID (and the folder's parent) itself
36+
folders.findByFileId(id).map(fld => {
3537
child_of += fld.id.toString
3638
child_of += fld.parentDatasetId.toString
37-
fld.id
38-
})
39-
datasets.get(folderlist).found.foreach(ds => {
40-
child_of += ds.id.toString
41-
ds.spaces.map(spid => child_of += spid.toString)
42-
ds.collections.map(collid => child_of += collid.toString)
4339
})
4440
val child_of_distinct = child_of.toList.distinct
4541

0 commit comments

Comments
 (0)