From 948ff8f1db78ad3558a7a2a20668fbb2e0866765 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 31 十月 2019 10:02:29 +0800 Subject: [PATCH] searchByPhoto twice add threshold filter --- controllers/fileController.go | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/fileController.go b/controllers/fileController.go index 3254db2..51df952 100644 --- a/controllers/fileController.go +++ b/controllers/fileController.go @@ -593,7 +593,7 @@ 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] @@ -626,7 +626,7 @@ 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] @@ -666,14 +666,14 @@ 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) } } -- Gitblit v1.8.0