@@ -61,11 +61,19 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
|||||||
|
|
||||||
String searchResponseYandex;
|
String searchResponseYandex;
|
||||||
String searchResponseGoogle;
|
String searchResponseGoogle;
|
||||||
|
List<YandexSearchResponse.ImageResult> allUniqueImages;
|
||||||
try {
|
try {
|
||||||
searchResponseYandex = searchImageService.searchReverseByPublicUrl(fileEntity, "yandex_reverse_image",
|
searchResponseYandex = searchImageService.searchReverseByPublicUrl(fileEntity, "yandex_reverse_image",
|
||||||
"visual_matches");
|
"visual_matches");
|
||||||
|
List<YandexSearchResponse.ImageResult> allYandexImages = searchImageService.getAllImagesWithoutPagination(
|
||||||
|
searchResponseYandex, "visual_matches");
|
||||||
searchResponseGoogle = searchImageService.searchReverseByPublicUrl(fileEntity, "google_lens",
|
searchResponseGoogle = searchImageService.searchReverseByPublicUrl(fileEntity, "google_lens",
|
||||||
"exact_matches");
|
"exact_matches");
|
||||||
|
|
||||||
|
List<YandexSearchResponse.ImageResult> allGoogleImages = searchImageService.getAllImagesWithoutPagination(
|
||||||
|
searchResponseGoogle, "exact_matches");
|
||||||
|
allUniqueImages = searchImageService.removeDuplicateUrls(allYandexImages,
|
||||||
|
allGoogleImages);
|
||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
log.warn("Search timeout for file {}, returning empty results", fileId);
|
log.warn("Search timeout for file {}, returning empty results", fileId);
|
||||||
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
|
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
|
||||||
@@ -85,14 +93,6 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
|||||||
|
|
||||||
checkCounterService.incrementCheckCount(fileEntity.getUserId(), fileEntity.getMimeType());
|
checkCounterService.incrementCheckCount(fileEntity.getUserId(), fileEntity.getMimeType());
|
||||||
|
|
||||||
List<YandexSearchResponse.ImageResult> allYandexImages = searchImageService.getAllImagesWithoutPagination(
|
|
||||||
searchResponseYandex, "visual_matches");
|
|
||||||
List<YandexSearchResponse.ImageResult> allGoogleImages = searchImageService.getAllImagesWithoutPagination(
|
|
||||||
searchResponseGoogle, "exact_matches");
|
|
||||||
|
|
||||||
List<YandexSearchResponse.ImageResult> allUniqueImages = searchImageService.removeDuplicateUrls(allYandexImages,
|
|
||||||
allGoogleImages);
|
|
||||||
|
|
||||||
int page = imageSearchRequest.getPage() != null ? imageSearchRequest.getPage() : 1;
|
int page = imageSearchRequest.getPage() != null ? imageSearchRequest.getPage() : 1;
|
||||||
int pageSize = 5;
|
int pageSize = 5;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user