Analyzer analyzer = createAnalyzer(srchOpts);
if (analyzer == null) {
return null;
}
String defField = getDefaultField(srchOpts);
QueryParser qp = new QueryParser(defField, analyzer);
Object ckXmlParser = find(srchOpts, "ckXmlParser");
Object ckWild = find(srchOpts, "ckWild");
Object ckPosIncr = find(srchOpts, "ckPosIncr");
Object ckLoExp = find(srchOpts, "ckLoExp");
Object cbDateRes = find(srchOpts, "cbDateRes");
DateTools.Resolution resolution = Util.getResolution(getString(cbDateRes, "text"));
Object cbOp = find(srchOpts, "cbOp");
Object bqMaxCount = find(srchOpts, "bqMaxCount");
int maxCount = 1024;
try {
maxCount = Integer.parseInt(getString(bqMaxCount, "text"));
} catch (Exception e) {
e.printStackTrace();
showStatus("Invalid BooleanQuery max clause count, using default 1024");
}
QueryParser.Operator op;
BooleanQuery.setMaxClauseCount(maxCount);
String opString = getString(cbOp, "text");
if (opString.equalsIgnoreCase("OR")) {
op = QueryParser.OR_OPERATOR;
} else {
op = QueryParser.AND_OPERATOR;
}
qp.setAllowLeadingWildcard(getBoolean(ckWild, "selected"));
qp.setEnablePositionIncrements(getBoolean(ckPosIncr, "selected"));
qp.setLowercaseExpandedTerms(getBoolean(ckLoExp, "selected"));
qp.setDateResolution(resolution);
qp.setDefaultOperator(op);
if (getBoolean(ckXmlParser, "selected")) {
CoreParser cp = createParser(defField,analyzer);
Query q = cp.parse(new ByteArrayInputStream(queryString.getBytes("UTF-8")));
return q;
} else {
return qp.parse(queryString);
}
}