mirror of https://github.com/apache/lucene.git
SOLR-12553: Check local params in SignificantTerms Query Parser
This commit is contained in:
parent
9d3cc1e16f
commit
f6e9d00b90
|
@ -157,6 +157,8 @@ Bug Fixes
|
||||||
* SOLR-12343: Fixed a bug in JSON Faceting that could cause incorrect counts/stats when using non default
|
* SOLR-12343: Fixed a bug in JSON Faceting that could cause incorrect counts/stats when using non default
|
||||||
sort options. This also adds a new configurable "overrefine" option. (Yonik Seeley, hossman)
|
sort options. This also adds a new configurable "overrefine" option. (Yonik Seeley, hossman)
|
||||||
|
|
||||||
|
* SOLR-12553: Allow SignificantTerms Query Parser to use local parameters (Alexandre Rafalovitch)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,18 @@ public class SignificantTermsQParserPlugin extends QParserPlugin {
|
||||||
@Override
|
@Override
|
||||||
public Query parse() throws SyntaxError {
|
public Query parse() throws SyntaxError {
|
||||||
String field = getParam("field");
|
String field = getParam("field");
|
||||||
int numTerms = Integer.parseInt(params.get("numTerms", "20"));
|
int numTerms = Integer.parseInt(getParamWithDefault("numTerms", "20"));
|
||||||
float minDocs = Float.parseFloat(params.get("minDocFreq", "5"));
|
float minDocs = Float.parseFloat(getParamWithDefault("minDocFreq", "5"));
|
||||||
float maxDocs = Float.parseFloat(params.get("maxDocFreq", ".3"));
|
float maxDocs = Float.parseFloat(getParamWithDefault("maxDocFreq", ".3"));
|
||||||
int minTermLength = Integer.parseInt(params.get("minTermLength", "4"));
|
int minTermLength = Integer.parseInt(getParamWithDefault("minTermLength", "4"));
|
||||||
|
|
||||||
return new SignificantTermsQuery(field, numTerms, minDocs, maxDocs, minTermLength);
|
return new SignificantTermsQuery(field, numTerms, minDocs, maxDocs, minTermLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getParamWithDefault(String paramName, String defaultValue) {
|
||||||
|
String result = getParam(paramName);
|
||||||
|
return (result != null)? result: defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SignificantTermsQuery extends AnalyticsQuery {
|
private static class SignificantTermsQuery extends AnalyticsQuery {
|
||||||
|
|
Loading…
Reference in New Issue