Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mjh000526 committed Jun 3, 2024
2 parents 8be6f5f + 9e4ca70 commit a6c3769
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 27 deletions.
Binary file modified .gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-05-31T13:27:07+0900",
date = "2024-06-03T09:49:05+0900",
comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.11 (AdoptOpenJDK)"
)
@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-05-31T13:27:07+0900",
date = "2024-06-03T09:49:06+0900",
comments = "version: 1.5.3.Final, compiler: IncrementalProcessingEnvironment from gradle-language-java-7.2.jar, environment: Java 11.0.11 (AdoptOpenJDK)"
)
@Component
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/example/just/JustApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableElasticsearchRepositories(
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/com/example/just/Service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,36 +362,36 @@ public ResponseGetPost searchByCursorMember(String cursor, Long limit, Long memb
randomIndex = random.nextInt(arrayLength);
String randonHashTagName = likePostHashTagName.get(randomIndex);
// 요청을 보낼 URL 설정
HttpGet request = new HttpGet("http://34.22.67.43:8081/api/similar_words/" + randonHashTagName);
HttpGet request = new HttpGet("http://127.0.0.1:8081/api/similar_words/" + randonHashTagName);

// 요청 실행 및 응답 수신
HttpResponse response = httpClient.execute(request);

// 응답 코드 확인
int statusCode = response.getStatusLine().getStatusCode();
System.out.println("Response Code: " + statusCode);
if (statusCode == 200) {

// 응답 데이터 읽기
String responseBody = EntityUtils.toString(response.getEntity());

// 여기서 Python Server의 추천 시스템으로 Post_id들을 가져온다.
List<Long> postIds = new ArrayList<>();
for (int i = 2; i < responseBody.length(); i += 5) {
postIds.add(Long.parseLong(responseBody.substring(i, i + 1)));
}

results = query.select(post)
.from(post)
.where(post.post_id.notIn(viewedPostIds), // 이전에 본 글들의 ID를 제외합니다.
post.post_create_time.isNotNull(), // 글 작성 시간이 NULL이 아닌 글들만 가져옵니다.
post.post_id.notIn(blames), // 신고한 글들의 ID를 제외합니다.
post.member.id.notIn(targetMembers),// 신고당한 회원들의 ID를 제외합니다.
post.post_id.in(postIds)) // 추천 시스템으로 가져온 글들의 ID만 가져옵니다.
.orderBy(Expressions.numberTemplate(Double.class, "function('rand')").asc()) // 랜덤으로 정렬합니다.
.limit(limit)
.fetch();
} else {
// if (statusCode == 200) {
//
// // 응답 데이터 읽기
// String responseBody = EntityUtils.toString(response.getEntity());
//
// // 여기서 Python Server의 추천 시스템으로 Post_id들을 가져온다.
// List<Long> postIds = new ArrayList<>();
// for (int i = 2; i < responseBody.length(); i += 5) {
// postIds.add(Long.parseLong(responseBody.substring(i, i + 1)));
// }
//
// results = query.select(post)
// .from(post)
// .where(post.post_id.notIn(viewedPostIds), // 이전에 본 글들의 ID를 제외합니다.
// post.post_create_time.isNotNull(), // 글 작성 시간이 NULL이 아닌 글들만 가져옵니다.
// post.post_id.notIn(blames), // 신고한 글들의 ID를 제외합니다.
// post.member.id.notIn(targetMembers),// 신고당한 회원들의 ID를 제외합니다.
// post.post_id.in(postIds)) // 추천 시스템으로 가져온 글들의 ID만 가져옵니다.
// .orderBy(Expressions.numberTemplate(Double.class, "function('rand')").asc()) // 랜덤으로 정렬합니다.
// .limit(limit)
// .fetch();
// } else {
results = query.select(post)
.from(post)
.where(post.post_id.notIn(viewedPostIds), // 이전에 본 글들의 ID를 제외합니다.
Expand All @@ -401,7 +401,7 @@ public ResponseGetPost searchByCursorMember(String cursor, Long limit, Long memb
.orderBy(Expressions.numberTemplate(Double.class, "function('rand')").asc())
.limit(limit)
.fetch();
}

} else {

results = query.select(post)
Expand Down

0 comments on commit a6c3769

Please sign in to comment.