Collapse AllExpand All

4.7. 실시간 인기 검색어 - demo.jsp

실시간 인기검색어를 사용하기 위해서는 JSP 스크립트에 검색을 수행한 후, 검색한 검색어의 hit 수를 count하는 부분을 추가해야 한다. (ksf/demo.jsp)

참고

서비스 프레임워크 소스의 domo.jsp에서 uncomment to enable real-time keyword rankings 라고 주석 처리된 세부분의 주석을 제거한다.

<%@ page import="org.apache.commons.lang3.StringUtils,...
 com.konantech.ksf.client.KsfClient,

KsfClient ksfclient = new KsfClient("http://localhost:7612/ksf");
 //검색한 쿼리의 hit수를 카운트 해준다.
ksfclient.hit(0, query); 

%>

<div class="box box-bordered">
 <div class="box-header box-header-small">
 <div class="title">실시간 인기검색어</div>
 <div class="actions">
 <span class="box-collapse ui-icon ui-icon-carat-1-n">
 </span>
 </div>
 </div>
 <%-- 실시간 인기 검색어 위젯이 삽입될 위치 --%>
 <div id="rankings2" class="box-content"></div>
 </div>
위젯 실행

/* uncomment to enable real-time keyword rankings */
 $( "#rankings2" ).rankings({ url: "api/rankings?realtime=true" });