dev add logs for search
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-16 10:13:42 +07:00
parent 1e14fa3f23
commit 814d137937
2 changed files with 19 additions and 2 deletions
@@ -87,18 +87,34 @@ public class ImageFoundRequestHandler implements RequestHandler {
List<YandexSearchResponse.ImageResult> allYandexImages = searchImageService.getAllImagesWithoutPagination(
searchResponseYandex, "visual_matches");
log.info("GET ALL YANDEX IMAGES!");
log.info("GET ALL YANDEX IMAGES!");
log.info("GET ALL YANDEX IMAGES!");
log.info("GET ALL YANDEX IMAGES!");
List<YandexSearchResponse.ImageResult> allGoogleImages = searchImageService.getAllImagesWithoutPagination(
searchResponseGoogle, "exact_matches");
List<YandexSearchResponse.ImageResult> allUniqueImages = searchImageService.removeDuplicateUrls(allYandexImages,
allGoogleImages);
log.info("GET ALL GOOGLE IMAGES!");
log.info("GET ALL GOOGLE IMAGES!");
log.info("GET ALL GOOGLE IMAGES!");
log.info("GET ALL GOOGLE IMAGES!");
int page = imageSearchRequest.getPage() != null ? imageSearchRequest.getPage() : 1;
int pageSize = 5;
List<YandexSearchResponse.ImageResult> pagedResults = searchImageService.paginateResults(allUniqueImages, page,
pageSize * 2);
log.info("GET ALL pagedResults IMAGES!");
log.info("GET ALL pagedResults IMAGES!");
log.info("GET ALL pagedResults IMAGES!");
log.info("GET ALL pagedResults IMAGES!");
log.info("GET ALL pagedResults IMAGES!");
log.info("GET ALL pagedResults IMAGES!");
YandexSearchResponse finalResponse = new YandexSearchResponse();
finalResponse.setImages(pagedResults);
finalResponse.setPage(page);
@@ -22,7 +22,7 @@ public class DaDataService {
private String apiKey ;
@Value("${dadata.url}")
private String url ;
private String dadataUrl;
private final OkHttpClient httpClient;
@@ -44,7 +44,7 @@ public class DaDataService {
String jsonBody = String.format("{\"query\": \"%s\"}", inn);
Request request = new Request.Builder()
.url("https://suggestions.dadata.ru/suggestions/api/4_1/rs/findById/party")
.url(dadataUrl)
.post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jsonBody))
.header("Accept", "application/json")
.header("Authorization", "Token " + apiKey)
@@ -52,6 +52,7 @@ public class DaDataService {
try (Response response = httpClient.newCall(request).execute()) {
ResponseBody body = response.body();
if (body == null) {
throw new IOException("Empty response body");
}