public class TestableCrossQuery extends CrossQuery
Modifier and Type | Field and Description |
---|---|
private String |
baseDir |
private String |
indexDirOverride |
private IndexWarmer |
indexWarmer |
private ThreadLocal<Integer> |
nHits |
config, decimalFormat, profListener
stylesheetCache
Constructor and Description |
---|
TestableCrossQuery(String baseDir)
Simplified initialization for use outside a real servlet container.
|
Modifier and Type | Method and Description |
---|---|
QueryProcessor |
createQueryProcessor()
For test mode, allow override of index warmer.
|
protected void |
formatHits(String mainTagName,
HttpServletRequest req,
HttpServletResponse res,
AttribList attribs,
QueryRequest queryRequest,
QueryResult queryResult,
long startTime)
Formats a list of hits using the resultFormatter stylesheet.
|
protected void |
genErrorPage(HttpServletRequest req,
HttpServletResponse res,
Exception exc)
Generate an error page based on the given exception.
|
int |
nHits()
Return the number of hits in the last request processed by this thread
|
void |
overrideIndexDir(String dir)
Allows overriding the directory specified in future query requests.
|
protected QueryRequest |
runQueryParser(HttpServletRequest req,
HttpServletResponse res,
QueryRoute route,
AttribList attribs)
Allow overriding the index directory
|
void |
service(String url)
Simplified method to test-get the given URL.
|
void |
setIndexWarmer(IndexWarmer warmer)
Allows overriding default index warmer.
|
protected void |
setupTrace(TextConfig config)
For test mode, do nothing to the current trace flags.
|
apply, doGet, getConfig, getConfigName, getServletInfo, readConfig, runQueryRouter, shuntQueryReq, stepSetup
addParam, addToken, addTokens, buildParamBlock, calcMimeType, convertUTF8inURL, cqlTokenize, createFilteredReceiver, decodeURL, defaultTokenize, destroy, doPost, getCurRequest, getCurResponse, getCurServlet, getRealPath, getRequestURL, getRequestURL, getText, isEmpty, isSessionTrackingEnabled, makeAttribList, makeHtmlString, makeHtmlString, rawTokenize, readBranding, requireOrElse, restoreWildcards, saveWildcards, service, setErrorGenSheet, stuffAttribs, stuffAttribs, stuffSpecialAttribs
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
private String baseDir
private String indexDirOverride
private IndexWarmer indexWarmer
private ThreadLocal<Integer> nHits
public TestableCrossQuery(String baseDir) throws ServletException
baseDir
- the XTF home directory.ServletException
- if anything goes wrong.public void overrideIndexDir(String dir)
public void setIndexWarmer(IndexWarmer warmer)
public int nHits()
protected void setupTrace(TextConfig config)
setupTrace
in class TextServlet
protected QueryRequest runQueryParser(HttpServletRequest req, HttpServletResponse res, QueryRoute route, AttribList attribs) throws Exception
runQueryParser
in class CrossQuery
req
- The original HTTP requestres
- The HTTP response (used for step mode only)route
- Route to the query parserattribs
- Attributes to pass to the stylesheet.Exception
public QueryProcessor createQueryProcessor()
createQueryProcessor
in class TextServlet
public void service(String url) throws ServletException, IOException
url
- the URL to test-getServletException
IOException
protected void formatHits(String mainTagName, HttpServletRequest req, HttpServletResponse res, AttribList attribs, QueryRequest queryRequest, QueryResult queryResult, long startTime) throws Exception
CrossQuery
formatHits
in class CrossQuery
mainTagName
- Name of the top-level tag to generate (e.g.
"crossQueryResult", etc.)req
- The original HTTP requestres
- Where to send the HTML responseattribs
- Parameters to pass to the stylesheetqueryRequest
- Query request that produced the hitsqueryResult
- Hits resulting from the query requeststartTime
- Time (in milliseconds) request beganException
protected void genErrorPage(HttpServletRequest req, HttpServletResponse res, Exception exc)
TextServlet
genErrorPage
in class TextServlet
req
- The HTTP request we're responding tores
- The HTTP result to write toexc
- The exception producing the error. If it's a
DynaXMLException, the attributes will be passed to
the error stylesheet.