| | |
| | | |
| | | var hasCompEsPerson = false |
| | | if searchBody.DataBases !=nil { |
| | | for _,tableId :=range searchBody.DataBases { |
| | | for idx,tableId :=range searchBody.DataBases { |
| | | if tableId == "esData" { |
| | | hasCompEsPerson = true |
| | | searchBody.DataBases = append(searchBody.DataBases[:idx], searchBody.DataBases[idx+1:]...) |
| | | break |
| | | } |
| | | } |
| | |
| | | return m |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | var sCompResult protomsg.SdkCompareResult |
| | | total := len(*co.CompareData) |
| | | if total <= to { |
| | | sCompResult.CompareResult = (*co.CompareData)[from:total] |
| | | } else {//底库数据的二次检索 |
| | | var dbpApi dbapi.DbPersonApi |
| | | personIds, _ := dbpApi.FindLikePersonIds(searchBody.DataBases, searchBody.InputValue) |
| | | logger.Debug("searchPhoto first Result.len:",len(*co.CompareData),"twice len(personIds):",len(personIds)) |
| | | if personIds !=nil && len(personIds)>0 { |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &personIds) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | | } else { |
| | | sCompResult.CompareResult = (*co.CompareData)[from:to] |
| | | aResult.CompareResult = (*aList)[from:to] |
| | | } |
| | | resultList := FillDataToCompareResult(&sCompResult) |
| | | |
| | | |
| | | m["total"] = total |
| | | out := FillDataToCompareResult(&aResult) |
| | | m["total"] = aTotal |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["totalList"] = resultList |
| | | m["totalList"] = out |
| | | return m |
| | | } else { |
| | | m["total"] = 0 |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["totalList"] = []interface{}{} |
| | | return m |
| | | } |
| | | } |
| | | |
| | | |
| | | //var sCompResult protomsg.SdkCompareResult |
| | | //total := len(*co.CompareData) |
| | | //if total <= to { |
| | | // sCompResult.CompareResult = (*co.CompareData)[from:total] |
| | | //} else { |
| | | // sCompResult.CompareResult = (*co.CompareData)[from:to] |
| | | //} |
| | | //resultList := FillDataToCompareResult(&sCompResult) |
| | | |
| | | |
| | | m["total"] = 0 |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["totalList"] = []interface{}{} |
| | | |
| | | return m |
| | | } |
| | | |
| | | func getTwiceSearchResult(co *service.CompareOnce, captureIds *[]string) *service.CompareList{ |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string) *service.CompareList{ |
| | | m := make(map[string]string) |
| | | for _,capId :=range *captureIds { |
| | | for _,capId :=range *scopeIds { |
| | | m[capId] = capId |
| | | } |
| | | var totalData service.CompareList |