Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/main/java/com/example/FixLog/domain/post/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,35 @@ public class Post {
private String coverImage;

@Lob // 텍스트가 길어질 수 있는 필드에 사용
@Column(nullable = false)
@Column(columnDefinition = "TEXT", nullable = false)
private String problem;

@Lob
@Column(nullable = false)
@Column(columnDefinition = "TEXT", nullable = false)
private String errorMessage;

@Lob
@Column(nullable = false)
@Column(columnDefinition = "TEXT", nullable = false)
private String environment;

@Lob
@Column(nullable = false)
@Column(columnDefinition = "TEXT", nullable = false)
private String reproduceCode;

@Lob
@Column(nullable = false)
@Column(columnDefinition = "TEXT", nullable = false)
private String solutionCode;

@Lob
@Column(columnDefinition = "TEXT")
private String causeAnalysis;

@Lob
@Column(columnDefinition = "TEXT")
private String referenceLink;

@Lob
@Column(columnDefinition = "TEXT")
private String extraContent;

@Column(nullable = false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/FixLog/domain/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Tag {
@Enumerated(EnumType.STRING)
private TagCategory tagCategory;

@Column(length = 20, nullable = false)
@Column(length = 50, nullable = false)
private String tagName;

private String tagInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public void run(String... args) {
.collect(Collectors.toMap(Tag::getTagName, tag -> tag));

List<String[]> config = List.of(
new String[]{"백엔드", "스프링부트", "자바", "NullPointerException", "500 Internal Server Error"},
new String[]{"프론트엔드", "리액트", "자바스크립트", "Cannot read property of undefined", "상태(state) 업데이트 누락"},
new String[]{"머신러닝", "케라스", "파이썬", "OutOfMemoryError", "HTTP 에러"},
new String[]{"백엔드", "노드", "JSON", "CORS 정책 오류", "404 Not Found"},
new String[]{"프론트엔드", "넥스트", "CSS", "스타일 깨짐", "렌더링 무한 루프"},
new String[]{"머신러닝", "사이킷런", "R", "ClassNotFoundException", "Permission Error"}
new String[]{"backend", "spring-boot", "java", "null-pointer-exception", "500-error"},
new String[]{"frontend", "react", "javascript", "undefined-property", "state-missing"},
new String[]{"machine-learning", "keras", "python", "out-of-memory", "http-error"},
new String[]{"backend", "node.js", "json", "cors-error", "404-error"},
new String[]{"frontend", "next.js", "css", "style-break", "render-loop"},
new String[]{"machine-learning", "scikit-learn", "r", "class-not-found", "permission-error"}
);

for (int i = 0; i < config.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ public Page<SearchPostDto> searchByKeywordAndTags(String keyword, List<String> t

// 2. 태그 조건 (AND 조건)
if (tags != null && !tags.isEmpty()) {
List<String> sanitizedTags = tags.stream()
.filter(tag -> tag != null && !tag.trim().isEmpty()) // null/빈값 제거
.map(String::trim) // 공백 제거
.toList();

NumberExpression<Long> count = postTag.tagId.tagId.count();

JPQLQuery<Long> subQuery = queryFactory
.select(postTag.postId.postId)
.from(postTag)
.where(postTag.tagId.tagName.in(tags))
.where(postTag.tagId.tagName.in(sanitizedTags)) // 이미 소문자면 lower() 생략 가능
.groupBy(postTag.postId.postId)
.having(count.eq((long) tags.size()));
.having(count.eq((long) sanitizedTags.size()));

builder.and(post.postId.in(subQuery));
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spring.application.name=FixLog
## JWT
#jwt.secret=${JWT_KEY}
#
## Spring Security 디버깅 로그
## Spring Security
#logging.level.org.springframework.security=DEBUG

##### [PROD] #####
Expand All @@ -50,4 +50,5 @@ jwt.secret=${JWT_KEY}

logging.level.root=INFO
logging.level.com.example.FixLog=DEBUG
logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG
logging.file.name=logs/app.log