| | |
| | | logger.Debug("searchPhoto first Result.len:",len(*co.CompareData),"twice len(captureIds):",len(captureIds)) |
| | | if captureIds !=nil { |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &captureIds) |
| | | aList := getTwiceSearchResult(co, &captureIds, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | personIdArr = append(personIdArr, pid.Id) |
| | | } |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &personIdArr) |
| | | aList := getTwiceSearchResult(co, &personIdArr, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | return m |
| | | } |
| | | |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string) *service.CompareList{ |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string, searchBody *models.EsSearch) *service.CompareList{ |
| | | m := make(map[string]string) |
| | | for _,capId :=range *scopeIds { |
| | | m[capId] = capId |
| | | } |
| | | var totalData service.CompareList |
| | | for _,each :=range *co.CompareData { |
| | | if _,ok :=m[each.Id];ok{ |
| | | if _,ok :=m[each.Id];ok && each.CompareScore > searchBody.Threshold { |
| | | totalData = append(totalData, each) |
| | | } |
| | | } |