dev change to visual_matches engine
Test Workflow / test (push) Successful in 4s

This commit is contained in:
vladp
2026-02-11 17:53:02 +07:00
parent 081ca05f88
commit 1cb9edd5bf
2 changed files with 9 additions and 6 deletions
@@ -58,7 +58,7 @@ public class SearchImageService {
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
}
public String searchReverseByPublicUrl(FileEntity fileEntity, String engine)
public String searchReverseByPublicUrl(FileEntity fileEntity, String engine, String searchType)
throws IOException, TimeoutException {
if (!isImageFile(fileEntity)) {
@@ -78,7 +78,7 @@ public class SearchImageService {
log.info("Searching reverse for image: {}", publicUrl);
try {
return callReverseImageApiByUrl(publicUrl, engine);
return callReverseImageApiByUrl(publicUrl, engine, searchType);
} catch (SocketTimeoutException e) {
log.error("Yandex search timeout after {}", fileEntity.getId());
throw new TimeoutException("Search timeout");
@@ -90,7 +90,7 @@ public class SearchImageService {
return mimeType != null && mimeType.startsWith("image");
}
private String callReverseImageApiByUrl(String imageUrl, String engine) throws IOException {
private String callReverseImageApiByUrl(String imageUrl, String engine, String searchType) throws IOException {
if (searchApiKey == null || searchApiKey.isBlank()) {
throw new IllegalStateException("SearchAPI key not configured");
@@ -101,7 +101,8 @@ public class SearchImageService {
.addQueryParameter("engine", engine)
.addQueryParameter("api_key", searchApiKey)
.addQueryParameter("url", imageUrl)
.addQueryParameter("search_type", "visual_matches")
// .addQueryParameter("search_type", "visual_matches")
.addQueryParameter("search_type", searchType)
.addQueryParameter("wait", "true")
.build();