mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 04:16:25 +08:00
Fix intersection of search results
This commit is contained in:
@@ -826,6 +826,7 @@ func (r *restream) GetProcessIDs(idpattern, refpattern string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
idmap := map[string]int{}
|
idmap := map[string]int{}
|
||||||
|
count := 0
|
||||||
|
|
||||||
if len(idpattern) != 0 {
|
if len(idpattern) != 0 {
|
||||||
for id := range r.tasks {
|
for id := range r.tasks {
|
||||||
@@ -838,8 +839,10 @@ func (r *restream) GetProcessIDs(idpattern, refpattern string) []string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
idmap[id] = 1
|
idmap[id]++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(refpattern) != 0 {
|
if len(refpattern) != 0 {
|
||||||
@@ -853,22 +856,20 @@ func (r *restream) GetProcessIDs(idpattern, refpattern string) []string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := idmap[t.id]; ok {
|
idmap[t.id]++
|
||||||
idmap[t.id]++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
ids := make([]string, len(idmap))
|
ids := []string{}
|
||||||
i := 0
|
|
||||||
|
|
||||||
for id, count := range idmap {
|
for id, n := range idmap {
|
||||||
if count == 1 {
|
if n != count {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ids[i] = id
|
ids = append(ids, id)
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ids
|
return ids
|
||||||
|
Reference in New Issue
Block a user