Skip to content

Commit

Permalink
Update TransportGetFindingsSearchAction.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Annie Lee committed Mar 30, 2022
1 parent 26014c4 commit f1997c0
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ class TransportGetFindingsSearchAction @Inject constructor(
object : ActionListener<SearchResponse> {
override fun onResponse(response: SearchResponse) {
val totalFindingCount = response.hits.totalHits?.value?.toInt()
val findings = mutableListOf<Finding>()
val findingsWithDocs = mutableListOf<FindingWithDocs>()
for (hit in response.hits) {
val id = hit.id
Expand All @@ -138,11 +137,9 @@ class TransportGetFindingsSearchAction @Inject constructor(
XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, xcp.nextToken(), xcp)
val finding = Finding.parse(xcp, id)
val doc_ids = finding.relatedDocId.split(",").toTypedArray()
val sourceIndex = finding.index
val docs = mutableListOf<FindingDocument>()
findings.add(finding)
for (doc_id in doc_ids) {
val document = searchDocument(doc_id, sourceIndex, docs, actionListener)
val document = searchDocument(doc_id, finding.index, docs, actionListener)
// TODO: remove debug log
log.info("document: $document")
}
Expand All @@ -166,7 +163,7 @@ class TransportGetFindingsSearchAction @Inject constructor(
sourceIndex: String,
docs: List<FindingDocument>,
actionListener: ActionListener<GetFindingsSearchResponse>
): FindingDocument? {
) {
val getRequest = GetRequest(sourceIndex, documentId)
var findingDocument: FindingDocument? = null
client.threadPool().threadContext.stashContext().use {
Expand Down Expand Up @@ -203,7 +200,6 @@ class TransportGetFindingsSearchAction @Inject constructor(
}
}
)
return findingDocument
}
}
}

0 comments on commit f1997c0

Please sign in to comment.