<%@ include file="init.jsp" %> <% String colorKeys[] = request.getParameterValues("colorKey"); String colorMorph = request.getParameter("colorMorph"); String resetModule = request.getParameter("mod"); String displayModule = request.getParameter("mod2"); String lastModType = (String) session.getAttribute("lastModType"); String activeModuleName = (resetModule != null)?resetModule : ((String) session.getAttribute(("GBS".equals(lastModType))?"gbsBook":"ActiveModule")); SWModule activeModule = mgr.getModuleByName((activeModuleName == null) ? defaultBible : activeModuleName); if ((resetModule != null) && (activeModule != null)) { if ("Generic Books".equals(activeModule.getCategory())) { session.setAttribute("gbsBook", resetModule); session.setAttribute("lastModType", "GBS"); } else { session.setAttribute("ActiveModule", resetModule); session.setAttribute("lastModType", "Bible"); } } lastModType = (String) session.getAttribute("lastModType"); SWModule activeModule2 = ("Bible".equals(lastModType) && parDispModules.size()>0) ? mgr.getModuleByName((String)parDispModules.get(0)) : null; if (activeModule2 != null && activeModule2.getName().equals(activeModule.getName())) activeModule2 = (parDispModules.size()>1) ? mgr.getModuleByName((String)parDispModules.get(1)) : null; if (displayModule != null) activeModule2 = mgr.getModuleByName(displayModule); String resetSearchTerm = request.getParameter("searchTerm"); if (resetSearchTerm != null) { // resetSearchTerm = new String(resetSearchTerm.getBytes("iso8859-1"), "UTF-8"); mgr.setGlobalOption("Greek Accents", "Off"); session.setAttribute("ActiveSearchTerm", mgr.filterText("Greek Accents", resetSearchTerm)); mgr.setGlobalOption("Greek Accents", "On"); } String activeSearchTerm = (String) session.getAttribute("ActiveSearchTerm"); String tmp = request.getParameter("range"); if (tmp != null) { tmp = new String(tmp.getBytes("iso8859-1"), "UTF-8"); session.setAttribute("ActiveRange", tmp); } String range = (String) session.getAttribute("ActiveRange"); if (range == null) { range = ""; } SearchType stype = null; tmp = request.getParameter("stype"); if (tmp != null) { if (tmp.equalsIgnoreCase("P")) { stype = SearchType.PHRASE; } if (tmp.equalsIgnoreCase("R")) { stype = SearchType.REGEX; } session.setAttribute("ActiveSearchType", stype); } stype = (SearchType) session.getAttribute("ActiveSearchType"); if (stype == null) { stype = (activeModule.hasSearchFramework()) ? SearchType.LUCENE : SearchType.MULTIWORD; } int soptions = 0; tmp = request.getParameter("icase"); if ((tmp != null) && (tmp.equals("1"))) { soptions = 2; session.setAttribute("ActiveSearchOptions", soptions); } Integer itmp = (Integer) session.getAttribute("ActiveSearchOptions"); if (itmp == null) { itmp = 0; // default to NOT ignore case } soptions = itmp; String specialFont = activeModule.getConfigEntry("Font"); if (specialFont.equalsIgnoreCase("")) { specialFont = null; } %> Search results for <%= activeSearchTerm %>
<% if (colorKeys != null) { %> <% } %>

Translations:

    <% for (int i = 0; i < modInfo.length; i++) { if (modInfo[i].category.equals(SwordOrb.BIBLES)) { SWModule module = mgr.getModuleByName(modInfo[i].name); %>
  • <%= module.getDescription() %>
  • <% } } %>

Original Language:

Results for "><%= activeSearchTerm %>

<% SearchHit[] results = null; if ((activeSearchTerm != null) && (activeSearchTerm.trim().length() > 0)) { mgr.setGlobalOption("Greek Accents", "Off"); results = activeModule.search(activeSearchTerm, stype, soptions, range); // let's make some intuitive decisions on when to sort by score if ((results.length > 100) && (activeSearchTerm.indexOf(" ") > 0) && (activeSearchTerm.indexOf("+") < 1) && (activeSearchTerm.indexOf("\"") < 1) && (activeSearchTerm.indexOf("~") < 1) ) { Arrays.sort(results, new Comparator() { public int compare(Object o1, Object o2) { return ((SearchHit)o2).score - ((SearchHit)o1).score; } }); } mgr.setGlobalOption("Greek Accents", "On"); //save the search result into the session so it can be retrived later on to browse through it session.setAttribute("SearchResults", results); } else if ( activeSearchTerm == null ) { //no search term given, try to see if we have a valid search result saved results = (SearchHit[]) session.getAttribute("SearchResults"); } if ( results == null ) { results = new SearchHit[0]; } %>

» <%= results.length %> result<%= (results.length == 1)?" ":"s "%> in the text of <%= activeModule.getDescription() %>

"> <% Integer resultStart = new Integer(request.getParameter("start") != null ? request.getParameter("start") : "0"); Integer resultLimit = new Integer(60); boolean rtol = ("RtoL".equalsIgnoreCase(activeModule.getConfigEntry("Direction"))); boolean showTwo = (activeModule2 != null && activeModule2.getRenderText().trim().length() > 0); for (int i = resultStart.intValue(); i < results.length && i < resultStart.intValue() + resultLimit.intValue(); i++) { activeModule.setKeyText(results[i].key); if (activeModule2 != null) activeModule2.setKeyText(results[i].key); String dispKey = results[i].key; %>
" title="<%= dispKey %>"><%= dispKey %>
" style="<%= specialFont != null ? "font-family:"+specialFont : "" %>"> <% if (showTwo) { %> <% } %>
<%= activeModule.getRenderText() %> <%= activeModule2.getRenderText() %>
<% } %>
    <% int navStart = (resultStart.intValue() / resultLimit.intValue()) - 5; if (navStart < 0) { navStart = 0; } int navEnd = navStart + 10; if ( navEnd*resultLimit.intValue() > results.length ) { navEnd = (results.length / resultLimit.intValue()) + ((results.length % resultLimit.intValue()) > 0 ? 1 : 0); } %>
  • Result Page:
  • <% if ( navStart > 0 ) { %>
  • 1 [...]
  • <% } else { if (results.length < resultLimit.intValue()) { %>
  • <%= 1 %>
  • <% } } String linkOptions = ""; if (colorKeys != null) { for (int k = 0; k < colorKeys.length; k++) { linkOptions += "colorKey=" + colorKeys[k] + "&"; // we always force a final param to let this & be ok } } linkOptions += "colorMorph=" + colorMorph; for (int i = navStart; i < navEnd; ++i) { if (i == (resultStart.intValue() / resultLimit.intValue())) { %>
  • <%= i+1 %>
  • <% } else { %>
  • <%= i+1 %>
  • <% } } int lastPage = (results.length / resultLimit.intValue()) + ((results.length % resultLimit.intValue()) > 0 ? 1 : 0) -1; if (navEnd < lastPage) { %>
  •  [...] <%= lastPage+1 %>
  • <% } %>