This commit is contained in:
@@ -11,13 +11,12 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface ImageSimilarityRepository
|
||||
extends JpaRepository<FileEntity, String> {
|
||||
|
||||
@Query(value = """
|
||||
|
||||
SELECT
|
||||
f.id AS similarFileId,
|
||||
f.id AS id,
|
||||
f.original_file_name AS originalFileName,
|
||||
f.file_size AS fileSize,
|
||||
f.user_id AS userId,
|
||||
h.hash64_hi AS hash64Hi,
|
||||
h.hash64_lo AS hash64Lo
|
||||
FROM image_hashes ref
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.soune.nocopy.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -20,6 +21,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FileSimilarityService {
|
||||
|
||||
private final ImageSimilarityRepository repository;
|
||||
@@ -55,6 +57,7 @@ public class FileSimilarityService {
|
||||
|
||||
return SimilarFileDTO.builder()
|
||||
.fileId(c.getId())
|
||||
.ownerId(c.getUserId())
|
||||
.originalFileName(c.getOriginalFileName())
|
||||
.fileSize(c.getFileSize())
|
||||
.hammingDistance(hamming)
|
||||
@@ -171,6 +174,7 @@ public class FileSimilarityService {
|
||||
|
||||
return SimilarFileDTO.builder()
|
||||
.fileId(similarImageProjection.getId())
|
||||
.ownerId(similarImageProjection.getUserId())
|
||||
.originalFileName(similarImageProjection.getOriginalFileName())
|
||||
.fileSize(similarImageProjection.getFileSize())
|
||||
.hammingDistance(hamming)
|
||||
|
||||
Reference in New Issue
Block a user