<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% /****************************************************************************** * Copyright (c) 2000-2005 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. ******************************************************************************/ %><%@page session="true" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Map" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils"%> <%@ page import="com.edeal.frontline.DataDictionary"%> <%@ page import="org.apache.solr.common.SolrDocumentList"%> <%@ page import="org.apache.solr.common.SolrDocument"%> <%@ page import="org.apache.solr.client.solrj.response.QueryResponse"%> <%@ page import="org.apache.solr.client.solrj.response.SpellCheckResponse"%> <%@ page import="org.apache.solr.client.solrj.response.FacetField" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String query = flRequest.getParameter("query"); String lngCode = flRequest.getParameter("lngCode"); if(Utils.isEmpty(lngCode)) lngCode = "fr_FR"; Boolean deepen = "on".equals(flRequest.getParameter("deepen")); QueryResponse rsp = (QueryResponse) flRequest.getAttribute("solr_response"); Hashtable faqsScores = (Hashtable)flRequest.getAttribute("faqs_score"); Hashtable faqsTags = (Hashtable)flRequest.getAttribute("faqs_tags"); Hashtable faqsStatus = (Hashtable)flRequest.getAttribute("faqs_status"); Hashtable faqsWithAttachment = (Hashtable)flRequest.getAttribute("faqs_with_attachment"); Hashtable faqsWithComment = (Hashtable)flRequest.getAttribute("faqs_with_comment"); String solID = flRequest.getRequestParameterOrAttribute("SolID"); String solTitle = flRequest.getRequestParameterOrAttribute("solToken"); solTitle += " " + flRequest.getRequestParameterOrAttribute("solSubject"); String catID = flRequest.getRequestParameterOrAttribute("catID"); String subCatID = flRequest.getRequestParameterOrAttribute("subCatID"); String crtID = flRequest.getRequestParameterOrAttribute("CrtID"); Vector lngCodes = (Vector)dico.getRefCodeList("FaqLngID"); String sfwID = flRequest.getRequestParameterOrAttribute("SfwID"); %> " objectTitle="K. Base" ou="">
<%=(!Utils.isEmpty(solID))? solTitle : ""+Utils.getMessage(session, "L8101", "Aucune demande sélectionnée")+"" %>
">
"> <% // Query formating error if (flRequest.getAttribute("query_failed") != null) { %> <% //Display results } if (rsp != null) { SolrDocumentList results = rsp.getResults(); List facets = rsp.getLimitingFacets(); Map>> highlight = rsp.getHighlighting(); SpellCheckResponse spell = rsp.getSpellCheckResponse(); boolean fFilteredResult=Boolean.TRUE.equals(rsp.getHeader().get("filtered_result")); %> <% if (fFilteredResult) {%> <% } %> <% //SpellChecker if (spell != null && spell.getCollatedResult() != null) { %> <% } %> <%} %>
 (<%=results.getNumFound()%>)

    : <% String urlSearch= "/knowledge_base.fl" + ((!Utils.isEmpty(solID))? "?SolID=" + solID + "&" : "?") + "core=knowledgebase&lngCode="+lngCode+"&query="+WebUtils.urlEncode(context, spell.getCollatedResult()) + (deepen ?"&deepen=on":""); %> " />"> <%= spell.getCollatedResult() %>

<% //Display results table boolean color = true; for (int i = 0; i < results.size(); ) { String last_obj = results.get(i).getFieldValue("meta_cat").toString(); //Display category %> <% while (i < results.size() && (last_obj.equals(results.get(i).getFieldValue("meta_cat")))) { String id = (String)results.get(i).getFieldValue("id"); //Display category content %>
<% //Print title w/ link if (results.get(i).getFieldValue("meta_reader") != null) out.print("" + results.get(i).getFieldValue("meta_title") + " " + faqsWithAttachment.get(id) + faqsStatus.get(id) + " "); else // Title w/o link out.print(results.get(i).getFieldValue("meta_title")); //Note : meta_title is allocated with EDEAL object's title in IndexSearch.java //basing on object's ID. For non EDEAL objects null is replaced by "[x]" %>
<% //Print text field(s) String str = ""; if(results.get(i).getFieldValue("all") != null ){ str = results.get(i).getFieldValue("all").toString(); } //Add highlighting if ((highlight.get(id) != null) && highlight.get(id).get("all") != null) { for (String hl : highlight.get(id).get("all")) { //str = str.replace(hl, "" + hl + ""); } } int len=str.length(); str=str.substring(0,(len<250)?len:250); int startSubstr=(str.startsWith("["))?1:0; int lenSubstr=(str.endsWith("]"))?1:0; %> <%=str.substring(startSubstr,str.length()-lenSubstr)%>...
<%=faqsScores.get(id) %> <%if(!Utils.isEmpty((String)faqsScores.get(id))){ %>   <%} %> <%=faqsWithComment.get(id)%>
<%if(!Utils.isEmpty((String)faqsTags.get(id))){ %>
: <%=faqsTags.get(id) %>
<%} %>

<% color = !(color); i++; } %> <% } %>