Apache Lucene open-source search software
fix HTML (& must be escaped as & in URLs); escape query in the "more results" link; fix typos in comments
Daniel Naber46ceb158797b
diff --git a/src/jsp/results.jsp b/src/jsp/results.jspindex 8309f15e05d..8788a35966a 100755--- a/src/jsp/results.jsp+++ b/src/jsp/results.jsp@@ -1,13 +1,13 @@-<%@ page import = " javax.servlet.*, javax.servlet.http.*, java.io.*, org.apache.lucene.analysis.*, org.apache.lucene.document.*, org.apache.lucene.index.*, org.apache.lucene.search.*, org.apache.lucene.queryParser.*, org.apache.lucene.demo.*, org.apache.lucene.demo.html.Entities" %>+<%@ page import = " javax.servlet.*, javax.servlet.http.*, java.io.*, org.apache.lucene.analysis.*, org.apache.lucene.document.*, org.apache.lucene.index.*, org.apache.lucene.search.*, org.apache.lucene.queryParser.*, org.apache.lucene.demo.*, org.apache.lucene.demo.html.Entities, java.net.URLEncoder" %><%/*Author: Andrew C. Oliver, SuperLink Software, Inc. ([email protected])- This jsp page is deliberatly written in the horrble java directly embedded- in the page style for an easy and conceise demonstration of Lucene.+ This jsp page is deliberatly written in the horrible java directly embedded+ in the page style for an easy and concise demonstration of Lucene.Due note...if you write pages that look like this...sooner or later- you'll have a maintenance nightmere. If you use jsps...use taglibs+ you'll have a maintenance nightmare. If you use jsps...use taglibsand beans! That being said, this should be acceptable for a smallpage demonstrating how one uses Lucene in a web app.@@ -68,11 +68,11 @@query = QueryParser.parse(queryString, "contents", analyzer); //parse the} catch (ParseException e) { //query and construct the Query//object- //if its just "operator error"+ //if it's just "operator error"//send them a nice error HTML%>- <p>Error While parsing query: <%=e.getMessage()%></p>+ <p>Error while parsing query: <%=e.getMessage()%></p><%error = true; //don't bother with the rest of//the page@@ -126,9 +126,10 @@<% if ( (startindex + maxpage) < hits.length()) { //if there are more results...display//the more link- String moreurl="results.jsp?query=" + queryString + //construct the "more" link- "&maxresults=" + maxpage +- "&startat=" + (startindex + maxpage);+ String moreurl="results.jsp?query=" ++ URLEncoder.encode(queryString) + //construct the "more" link+ "&maxresults=" + maxpage ++ "&startat=" + (startindex + maxpage);%><tr><td></td><td><a href="<%=moreurl%>">More Results>></a></td>