Newer
Older
TalkjaSolr / web / WEB-INF / jsp / _document.jsp
@haya4 haya4 on 22 Apr 2022 1 KB restore
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
Map<String, List<String>> highlighting = rsp.getHighlighting().get(document.getFirstValue("url"));
String summary = "";
String contents = "";
boolean first = true;
if(document.getFieldValues("contents") != null){
  for(Object line : document.getFieldValues("contents")){
    if(!first){
      contents += ", ";
    }else{
      first = false;
    }
    contents += line.toString();
  }
}

first = true;
for(String field : SearchUtil.getSummaryHighlightFields()){
  if(highlighting.get(field) != null){
    for(String text : highlighting.get(field)){
      if(!first){
        summary += "...";
      }else{
        first = false;
      }
      summary += text;
    }
  }
}
String info = "";
if(document.getFirstValue("id") != null){
  info += "id:"+document.getFirstValue("id");
}
if(document.getFirstValue("name") != null){
  if(info.length() > 0){
    info += " | ";
  }
  info += document.getFirstValue("name");
}
%>
<h2><a href="<%=document.getFieldValue("url") %>"><%=highlighting.get("title").get(0) %></a></h2>
<div class="articles"><%=summary%></div>
<br/>
<div class="articles"><%=StringEscapeUtils.escapeHtml(contents)%></div>

<div class="articles"><%=StringEscapeUtils.escapeHtml(info) %></div>
<hr/>