* cmd reopen, accuracy, suggestionCount, restrictToField, and onlyMorePopular.
*/
@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
throws Exception {
SolrParams p = req.getParams();
String words = p.get("q");
String cmd = p.get("cmd");
if (cmd != null) {
cmd = cmd.trim();
if (cmd.equals("rebuild")) {
rebuild(req);
rsp.add("cmdExecuted","rebuild");
} else if (cmd.equals("reopen")) {
reopen();
rsp.add("cmdExecuted","reopen");
} else {
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unrecognized Command: " + cmd);
}
}
// empty query string
if (null == words || "".equals(words.trim())) {
return;
}
IndexReader indexReader = null;
String suggestionField = null;
Float accuracy;
int numSug;
boolean onlyMorePopular;
boolean extendedResults;
try {
accuracy = p.getFloat(ACCURACY, p.getFloat("accuracy", DEFAULT_ACCURACY));
spellChecker.setAccuracy(accuracy);
} catch (NumberFormatException e) {
throw new RuntimeException("Accuracy must be a valid positive float", e);
}
try {
numSug = p.getInt(SUGGESTIONS, p.getInt("suggestionCount", DEFAULT_SUGGESTION_COUNT));
} catch (NumberFormatException e) {
throw new RuntimeException("Spelling suggestion count must be a valid positive integer", e);
}
try {
onlyMorePopular = p.getBool(POPULAR, DEFAULT_MORE_POPULAR);
} catch (SolrException e) {
throw new RuntimeException("'Only more popular' must be a valid boolean", e);
}
try {
extendedResults = p.getBool(EXTENDED, DEFAULT_EXTENDED_RESULTS);
} catch (SolrException e) {
throw new RuntimeException("'Extended results' must be a valid boolean", e);
}
// when searching for more popular, a non null index-reader and