@@ -61,7 +61,7 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
//TODO отдавать любой полученный результат,даже если по таймауту падают
|
||||
|
||||
String searchResponseYandex = null;
|
||||
String searchResponseGoogle = null;
|
||||
// String searchResponseGoogle = null;
|
||||
List<YandexSearchResponse.ImageResult> allYandexImages = new ArrayList<>();
|
||||
List<YandexSearchResponse.ImageResult> allGoogleImages = new ArrayList<>();
|
||||
List<YandexSearchResponse.ImageResult> allUniqueImages;
|
||||
@@ -80,18 +80,18 @@ public class ImageFoundRequestHandler implements RequestHandler {
|
||||
log.error("Yandex search failed for file {}", fileId, e);
|
||||
}
|
||||
|
||||
try {
|
||||
searchResponseGoogle = searchImageService.searchReverseByPublicUrl(fileEntity, "google_lens",
|
||||
"exact_matches");
|
||||
log.info("searchResponseGoogle OK");
|
||||
allGoogleImages = searchImageService.getAllImagesWithoutPagination(
|
||||
searchResponseGoogle, "exact_matches");
|
||||
} catch (TimeoutException e) {
|
||||
log.warn("Google search timeout for file {}", fileId);
|
||||
hasTimeout = true;
|
||||
} catch (IOException e) {
|
||||
log.error("Google search failed for file {}", fileId, e);
|
||||
}
|
||||
// try {
|
||||
// searchResponseGoogle = searchImageService.searchReverseByPublicUrl(fileEntity, "google_lens",
|
||||
// "exact_matches");
|
||||
// log.info("searchResponseGoogle OK");
|
||||
// allGoogleImages = searchImageService.getAllImagesWithoutPagination(
|
||||
// searchResponseGoogle, "exact_matches");
|
||||
// } catch (TimeoutException e) {
|
||||
// log.warn("Google search timeout for file {}", fileId);
|
||||
// hasTimeout = true;
|
||||
// } catch (IOException e) {
|
||||
// log.error("Google search failed for file {}", fileId, e);
|
||||
// }
|
||||
|
||||
allUniqueImages = searchImageService.removeDuplicateUrls(allYandexImages, allGoogleImages);
|
||||
log.info("allUniqueImages OK: {} images", allUniqueImages.size());
|
||||
|
||||
Reference in New Issue
Block a user