//but I would prefer the separate method)
/** runPreProcessing */
public void runPreProcessing(SearchRequest srq)
{
Request rq = (Request)srq;
Query query = rq.getQuery();
//System.out.println(query);
//get the controls
try{
boolean rtr = ! query.obtainControls(Allowed_Controls, rq.getControlHashtable());
//we check that there is stil something left in the query
if (! rtr)
{
rq.setEmpty(true);
return;
}
/*if(ApplicationSetup.getProperty("querying.manager.sendlang","").equals("true"))
{
String lang = rq.getControl("lang").toLowerCase();
String marker = ApplicationSetup.getProperty("termpipelines.languageselector.markerlang", "||LANG:");
if(lang.length() > 0)
{
if(logger.isDebugEnabled()){
logger.debug("Sending marker through pipeline "+marker+lang);
}
pipelineTerm(marker+lang);
}
}*/
synchronized(this) {
rtr = query.applyTermPipeline(tpa);
tpa.resetPipeline();
}
Map<String,String> controls = rq.getControlHashtable();
for(int i=0; i<PreProcesses_Order.length; i++)
{
String PreProcesses_Name = PreProcesses_Order[i];
for(int j=0; j<PreProcesses_Controls[i].length; j++)
{
String ControlName = PreProcesses_Controls[i][j];
String value = (String)controls.get(ControlName);
//System.err.println(ControlName+ "("+ControlName+") => "+value);
if (value == null)
continue;
value = value.toLowerCase();
if(! (value.equals("off") || value.equals("false")))
{
if (logger.isDebugEnabled()){
logger.debug("Processing: "+PreProcesses_Name);
}
getPreProcessModule(PreProcesses_Name).process(this, srq);
//we've now run this pre process module, no need to check the rest of the controls for it.
break;
}
}
}
String lastPP = null;
if ((lastPP = ApplicationSetup.getProperty("querying.lastpreprocess",null)) != null)
{
getPreProcessModule(lastPP).process(this, srq);
}
if (! rtr)
{
rq.setEmpty(true);
return;
}
if (ApplicationSetup.getProperty("querying.no.negative.requirement", "").equals("true"))
{
ArrayList<org.terrier.querying.parser.Query> terms = new ArrayList<org.terrier.querying.parser.Query>();
query.getTermsOf(org.terrier.querying.parser.SingleTermQuery.class, terms, true);
for(Query sqt : terms)
((org.terrier.querying.parser.SingleTermQuery)sqt).setRequired(0);
}
MatchingQueryTerms queryTerms = new MatchingQueryTerms(rq.getQueryID(), rq);
query.obtainQueryTerms(queryTerms);
rq.setMatchingQueryTerms(queryTerms);
}
catch(Exception e){
}
}