Filters might have updated the destuids. facetMatrix should also be updated to exclude uids that were removed..
()
| 1394 | // Filters might have updated the destuids. facetMatrix should also be updated to exclude uids that |
| 1395 | // were removed.. |
| 1396 | func (sg *SubGraph) updateFacetMatrix() { |
| 1397 | if len(sg.facetsMatrix) != len(sg.uidMatrix) { |
| 1398 | return |
| 1399 | } |
| 1400 | |
| 1401 | for lidx, l := range sg.uidMatrix { |
| 1402 | // For scalar predicates, uid list would be empty, we don't need to update facetsMatrix. |
| 1403 | // If its an uid predicate and uid list is empty then also we don't need to update |
| 1404 | // facetsMatrix, as results won't be returned to client in outputnode.go. |
| 1405 | if len(l.Uids) == 0 { |
| 1406 | continue |
| 1407 | } |
| 1408 | out := sg.facetsMatrix[lidx].FacetsList[:0] |
| 1409 | for idx, uid := range l.Uids { |
| 1410 | // If uid wasn't filtered then we keep the facet for it. |
| 1411 | if algo.IndexOf(sg.DestUIDs, uid) >= 0 { |
| 1412 | out = append(out, sg.facetsMatrix[lidx].FacetsList[idx]) |
| 1413 | } |
| 1414 | } |
| 1415 | sg.facetsMatrix[lidx].FacetsList = out |
| 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | // updateUidMatrix is used to filter out the uids in uidMatrix which are not part of DestUIDs |
| 1420 | // anymore. Some uids might have been removed from DestUids after application of filters, |
no test coverage detected