Skip to content

Commit

Permalink
feat(front-end): 검색 결과 화면에서 내용이 너무 길면 자르기
Browse files Browse the repository at this point in the history
(front-end): 검색 옵션 선택 기능 구현 완료될 때까지 버튼 제거

(back-end): 연동 문제로 es 제거
  • Loading branch information
inpink committed Mar 14, 2024
1 parent 5372f65 commit 2c59772
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 207 deletions.
27 changes: 27 additions & 0 deletions knusearch.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAjpl/kykVoPc6zHGcBiG58yCFYezx5Z9sz0d64NCe1veNzmwH
+Wf9GwnATRTI/bFzKWZ0dnlQMaSNNIRAKzXsAxh3FNbJDyicbTcWYQ3tRQCOCXDu
m5q4X+3f/Jef/p3Z2/8/mv8cf3/7bkZycU+kstbmjrDDEPNWB2WXlszaeyqAaJEg
8hrRArLA1m70dyScAzaPrP/OSz14p5uRqzQoavhWudZ74W/K9qtNiFMZohlz+QYb
iChy5ZQfMSdNwpDfcgz5FsbedNAHdbfXjpgAxO3uQoPEI/dNcwaRlA7QBLI9XsDP
ggHXnJv+bESVD9kD1/vccbMlaoynOcOMze+9kQIDAQABAoIBAFhudKEMP299Iiea
5MkgrTJLHqxlxnVB8rZwe5Fjjr1886HpeOCAToQv/eNPWn2JSAOKl/rIrKS8iRzi
TvD9FYmt6Fsx/6m445kPKn+xpUy/VVYhhLdWsbQ7zkXUudGqjmpR1l4GiuO+uGvg
oCQI4fhOMNiYYb/nR5h6thE8pNjvxoR8nMZ+m9To5MbNHmAPhZMB5w3vpuaDJ2cC
HdYztMyM/ezdbEAoG3EW88Up/edpH9jPmz6SQBt2x5MOABP5I0rRU1o8/mLt2HK0
0/jzX77IYm2AWj2zcucrvref4YAoknKMR6El6ei6ltcb9BKJvTco56XxdHsnVpSM
g41x7eECgYEA6rINQ0WJbtthL/6N3OXoNfvcAqKVr160cRQMtU01DsayJRVP3Y6L
7e789fUHFDk0ah1EyUVYwrHrYv/V6cwoUOcgrrsYIrfJmFuNJEGBFDpVUbqI+USv
idpOQQv8bNKJLBTWaNO4QfzYpwIk26ewBv8Ul1nohYhpwdJl1Lb2YdUCgYEAm4tI
8CKwVYvU+bjQUST7z9jSGo2HLbzqTDvBHugiYVwAfL01hPRXYA1fbIzMSQajTs5+
PNf1urkGyKcl26EWo03biMhzJ4aTcfVcTmgdr0PCA0eTI6x86Q777X3WsSaiClpW
rZjzG0HudDCY65fraUIh0cRsxKpEJLVdZBNCzs0CgYAdaWTaGlvHxbxfPGJg3XsF
UOPYfLGPganRRfb1vZA5otLubMZOeK+2iK2w0R0q/qQ/7B0TsBoYhB2AkZkoLIqc
4Ooqm43BxBCChG6irYbUlx7cGClUO7RX7UDDTBI9PQEtwgrApk/ADUTFYTJnSJN5
vPvCn+TQ3zCJtqlGSAuGZQKBgCGREmF4KvObJI/rmVEZmRoGoXjHeBefwDRJZOjF
kb3O++/vaSBTFpQM7r3fOKq9uvpjx4xb0pTEHzmoEJxwDBGb2LeRAoDSIvmhyJTH
FTjgd3r7tD4rmB03dZiP4ogCXU+8pR37duM3/DyozCdzdoMVmXTKXeqnD+OYHBpf
qbg1AoGAJHlbJ2l/q4UPwUyDTjTQYFTgquXikPufGxax9B89LZBx1z7Z2FN8ZhOg
iC5QzYIZxvizgW7EN1nGJX+qdb2M+Q6aMzgZGp3sKkqHIAh3UooFx5V6NJqVANSU
ikiKqBayKlIcXIM+xBO3suMh+NaXgirUBre/5Sq5HkOPG8afTDI=
-----END RSA PRIVATE KEY-----

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import knusearch.clear.jpa.domain.dto.BasePostRequest;
import knusearch.clear.jpa.service.ClassificationService;
import knusearch.clear.jpa.service.DateService;
import knusearch.clear.jpa.service.SearchService;
import knusearch.clear.jpa.service.MySqlSearchService;
import knusearch.clear.util.StringUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
Expand All @@ -30,7 +29,7 @@
public class SearchController { //TODO:프론트, 백, AI 전반적으로 사용한 툴 모두 적고 모든 툴 사용한 이유 정리하여 작성, 발표

private final DateService dateService;
private final SearchService searchService;
private final MySqlSearchService mySqlSearchService;
private final ClassificationService classificationService;

@GetMapping("/search")
Expand All @@ -40,11 +39,11 @@ public String searchForm(Model model) {
SearchForm searchForm = new SearchForm();

// YAML 파일에서 모든 site명을 가져와서 ArrayList에 담기
List<String> selectedSites = searchService.findSites();
String searchScopeRadio = searchService.findOrder();
List<String> selectedSites = mySqlSearchService.findSites();
String searchScopeRadio = mySqlSearchService.findOrder();

//기간 값 추가
String searchPeriodRadio = searchService.findPeriod();
String searchPeriodRadio = mySqlSearchService.findPeriod();
LocalDate searchPeriod_start = dateService.minDate();
LocalDate searchPeriod_end = dateService.currentDate();

Expand Down Expand Up @@ -158,10 +157,10 @@ private Page<BasePostRequest> searchResults(String categoryRecommendChecked,

if (categoryRecommendChecked==null) {
System.out.println("분류 사용 X");
searchResultWithCount = searchService.searchAndPosts(words);
searchResultWithCount = mySqlSearchService.searchAndPosts(words);
} else {
System.out.println("분류 사용 O");
searchResultWithCount = searchService.searchAndPostWithBoostClassification(
searchResultWithCount = mySqlSearchService.searchAndPostWithBoostClassification(
words, refinedPredictedClass); //검색어의 분류정보
}
// count개수 담은 basepost map 보내기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;

import knusearch.clear.jpa.domain.dto.BasePostRequest;
import knusearch.clear.jpa.domain.post.BasePost;
import knusearch.clear.jpa.repository.SearchRepository;
import knusearch.clear.jpa.repository.post.BasePostRepository;
import knusearch.clear.mvc.service.SearchService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Primary
@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class SearchService {
public class MySqlSearchService implements SearchService {

private final SearchRepository searchRepository;
private final BasePostRepository basePostRepository;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/knusearch/clear/mvc/service/SearchService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package knusearch.clear.mvc.service;

public interface SearchService {
}
4 changes: 2 additions & 2 deletions src/main/resources/templates/fragments/parentOptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
</div>

<!-- 버튼을 클릭하여 펼치기/접기 토글. 다른 div에 있는 것도 펼치고접을 수 있다. -->
<div class="m-auto">
<!--div class="m-auto">
<button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDiv"
aria-expanded="false" aria-controls="collapseDiv">
세부 옵션 설정
</button>
</div>
</div-->
</div>
40 changes: 20 additions & 20 deletions src/main/resources/templates/fragments/postSearchResult.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<div class="postSearchResult" th:fragment="postSearchResult" style="text-align: left; max-width: 100%;">
<div class="d-flex bg-skyblue p-3 border rounded">
<!-- 검색 결과 목록 출력 -->
<p>검색 개수 : <span th:text="${searchResult.totalElements}"></span><br></p>
<hr>
<ul>
<li th:each="post, stat : ${searchResult}">
<p>번호: <span
th:text="${stat.index + 1 + (searchResult.pageable.pageNumber * searchResult.pageable.pageSize)}"></span>
</p> <!-- 게시글 번호 출력 -->
<p>ID: <span th:text="${post.id}"></span></p>
<p>제목: <a th:href="${post.url}" th:text="${post.title}" target="_blank"></a></p>
<p>내용: <span th:text="${post.text}"></span></p>
<p>등록 날짜: <span th:text="${post.dateTime}"></span></p>
<p>분류: <span th:text="${post.classification}"></span></p>
<!-- 다른 필드들도 필요에 따라 출력하세요. -->
<!-- 검색 결과 목록 출력 -->
<p>검색 개수 : <span th:text="${searchResult.totalElements}"></span></p>
<ul>
<li th:each="post, stat : ${searchResult}">
<p>번호: <span
th:text="${stat.index + 1 + (searchResult.pageable.pageNumber * searchResult.pageable.pageSize)}"></span>
</p> <!-- 게시글 번호 출력 -->
<p>ID: <span th:text="${post.id}"></span></p>
<p>제목: <a th:href="${post.url}"
th:text="${post.title.length() > 40 ? post.title.substring(0, 40) + '...' : post.title}"
target="_blank"></a></p>
<p>내용: <a th:href="${post.url}"
th:text="${post.text.length() > 40 ? post.text.substring(0, 40) + '...' : post.text}"
target="_blank"></a></p>
<p>등록 날짜: <span th:text="${post.dateTime}"></span></p>
<p>분류: <span th:text="${post.classification}"></span></p>
<!-- 다른 필드들도 필요에 따라 출력하세요. -->

<hr>
</li>
</ul>
</div>
<hr>
</li>
</ul>
</div>
</html>
6 changes: 3 additions & 3 deletions src/main/resources/templates/searchResult.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ <h1 class="text-center">검색 결과</h1>
<br>

<div th:if="${isSearchEnabled} == true">
<div class="jumbotron bg-light" style="width: 110%;"> <!-- 회색 박스 -->
<div class="jumbotron bg-light" style="width: 100%;"> <!-- 회색 박스 -->

<!--AI가 추천하는 분류-->
<div th:if="${searchForm.categoryRecommendChecked} != null">
<p>AI가 추천하는 분류</p>
<div class="d-flex bg-skyblue p-3 border rounded">
<p th:text="${predictedClass} ">분류</p>
<p><br>학사:0, 장학:1, 학습,상담:2, 취창업:3</p>
<p>분류: <span th:text="${predictedClass}"></span></p>
<p> (학사:0, 장학:1, 학습,상담:2, 취창업:3)</p>
</div>
</div>

Expand Down
Loading

0 comments on commit 2c59772

Please sign in to comment.