mirror of https://github.com/apache/lucene.git
remove private subclasses created for accessing static methods ... they were put in originally to be short aliases for the real classnames, but some people found them more confusing.
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@688169 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
088bdde5ac
commit
c9d64b5a26
|
@ -52,10 +52,6 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
|
||||||
long handlerStart = System.currentTimeMillis();
|
long handlerStart = System.currentTimeMillis();
|
||||||
protected boolean httpCaching = true;
|
protected boolean httpCaching = true;
|
||||||
|
|
||||||
/** shorten the class references for utilities */
|
|
||||||
private static class U extends SolrPluginUtils {
|
|
||||||
/* :NOOP */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the {@link org.apache.solr.request.SolrRequestHandler} by creating three {@link org.apache.solr.common.params.SolrParams} named:
|
* Initializes the {@link org.apache.solr.request.SolrRequestHandler} by creating three {@link org.apache.solr.common.params.SolrParams} named:
|
||||||
|
@ -130,7 +126,7 @@ public abstract class RequestHandlerBase implements SolrRequestHandler, SolrInfo
|
||||||
public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
|
public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp) {
|
||||||
numRequests++;
|
numRequests++;
|
||||||
try {
|
try {
|
||||||
U.setDefaults(req,defaults,appends,invariants);
|
SolrPluginUtils.setDefaults(req,defaults,appends,invariants);
|
||||||
rsp.setHttpCaching(httpCaching);
|
rsp.setHttpCaching(httpCaching);
|
||||||
handleRequestBody( req, rsp );
|
handleRequestBody( req, rsp );
|
||||||
// count timeouts
|
// count timeouts
|
||||||
|
|
|
@ -61,16 +61,6 @@ class DismaxQParser extends QParser {
|
||||||
*/
|
*/
|
||||||
private static String IMPOSSIBLE_FIELD_NAME = "\uFFFC\uFFFC\uFFFC";
|
private static String IMPOSSIBLE_FIELD_NAME = "\uFFFC\uFFFC\uFFFC";
|
||||||
|
|
||||||
/** shorten the class references for utilities */
|
|
||||||
private static class U extends SolrPluginUtils {
|
|
||||||
/* :NOOP */
|
|
||||||
}
|
|
||||||
|
|
||||||
/** shorten the class references for utilities */
|
|
||||||
private static interface DMP extends DisMaxParams {
|
|
||||||
/* :NOOP */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DismaxQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
|
public DismaxQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
|
||||||
super(qstr, localParams, params, req);
|
super(qstr, localParams, params, req);
|
||||||
|
@ -91,13 +81,13 @@ class DismaxQParser extends QParser {
|
||||||
|
|
||||||
IndexSchema schema = req.getSchema();
|
IndexSchema schema = req.getSchema();
|
||||||
|
|
||||||
queryFields = U.parseFieldBoosts(solrParams.getParams(DMP.QF));
|
queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(DisMaxParams.QF));
|
||||||
Map<String,Float> phraseFields = U.parseFieldBoosts(solrParams.getParams(DMP.PF));
|
Map<String,Float> phraseFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(DisMaxParams.PF));
|
||||||
|
|
||||||
float tiebreaker = solrParams.getFloat(DMP.TIE, 0.0f);
|
float tiebreaker = solrParams.getFloat(DisMaxParams.TIE, 0.0f);
|
||||||
|
|
||||||
int pslop = solrParams.getInt(DMP.PS, 0);
|
int pslop = solrParams.getInt(DisMaxParams.PS, 0);
|
||||||
int qslop = solrParams.getInt(DMP.QS, 0);
|
int qslop = solrParams.getInt(DisMaxParams.QS, 0);
|
||||||
|
|
||||||
/* a generic parser for parsing regular lucene queries */
|
/* a generic parser for parsing regular lucene queries */
|
||||||
QueryParser p = schema.getSolrQueryParser(null);
|
QueryParser p = schema.getSolrQueryParser(null);
|
||||||
|
@ -105,15 +95,15 @@ class DismaxQParser extends QParser {
|
||||||
/* a parser for dealing with user input, which will convert
|
/* a parser for dealing with user input, which will convert
|
||||||
* things to DisjunctionMaxQueries
|
* things to DisjunctionMaxQueries
|
||||||
*/
|
*/
|
||||||
U.DisjunctionMaxQueryParser up =
|
SolrPluginUtils.DisjunctionMaxQueryParser up =
|
||||||
new U.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
|
new SolrPluginUtils.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
|
||||||
up.addAlias(IMPOSSIBLE_FIELD_NAME,
|
up.addAlias(IMPOSSIBLE_FIELD_NAME,
|
||||||
tiebreaker, queryFields);
|
tiebreaker, queryFields);
|
||||||
up.setPhraseSlop(qslop);
|
up.setPhraseSlop(qslop);
|
||||||
|
|
||||||
/* for parsing sloppy phrases using DisjunctionMaxQueries */
|
/* for parsing sloppy phrases using DisjunctionMaxQueries */
|
||||||
U.DisjunctionMaxQueryParser pp =
|
SolrPluginUtils.DisjunctionMaxQueryParser pp =
|
||||||
new U.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
|
new SolrPluginUtils.DisjunctionMaxQueryParser(schema, IMPOSSIBLE_FIELD_NAME);
|
||||||
pp.addAlias(IMPOSSIBLE_FIELD_NAME,
|
pp.addAlias(IMPOSSIBLE_FIELD_NAME,
|
||||||
tiebreaker, phraseFields);
|
tiebreaker, phraseFields);
|
||||||
pp.setPhraseSlop(pslop);
|
pp.setPhraseSlop(pslop);
|
||||||
|
@ -130,7 +120,7 @@ class DismaxQParser extends QParser {
|
||||||
altUserQuery = null;
|
altUserQuery = null;
|
||||||
if( userQuery == null || userQuery.trim().length() < 1 ) {
|
if( userQuery == null || userQuery.trim().length() < 1 ) {
|
||||||
// If no query is specified, we may have an alternate
|
// If no query is specified, we may have an alternate
|
||||||
String altQ = solrParams.get( DMP.ALTQ );
|
String altQ = solrParams.get( DisMaxParams.ALTQ );
|
||||||
if (altQ != null) {
|
if (altQ != null) {
|
||||||
altQParser = subQuery(altQ, null);
|
altQParser = subQuery(altQ, null);
|
||||||
altUserQuery = altQParser.parse();
|
altUserQuery = altQParser.parse();
|
||||||
|
@ -141,17 +131,17 @@ class DismaxQParser extends QParser {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// There is a valid query string
|
// There is a valid query string
|
||||||
userQuery = U.partialEscape(U.stripUnbalancedQuotes(userQuery)).toString();
|
userQuery = SolrPluginUtils.partialEscape(SolrPluginUtils.stripUnbalancedQuotes(userQuery)).toString();
|
||||||
userQuery = U.stripIllegalOperators(userQuery).toString();
|
userQuery = SolrPluginUtils.stripIllegalOperators(userQuery).toString();
|
||||||
|
|
||||||
String minShouldMatch = solrParams.get(DMP.MM, "100%");
|
String minShouldMatch = solrParams.get(DisMaxParams.MM, "100%");
|
||||||
Query dis = up.parse(userQuery);
|
Query dis = up.parse(userQuery);
|
||||||
parsedUserQuery = dis;
|
parsedUserQuery = dis;
|
||||||
|
|
||||||
if (dis instanceof BooleanQuery) {
|
if (dis instanceof BooleanQuery) {
|
||||||
BooleanQuery t = new BooleanQuery();
|
BooleanQuery t = new BooleanQuery();
|
||||||
U.flattenBooleanQuery(t, (BooleanQuery)dis);
|
SolrPluginUtils.flattenBooleanQuery(t, (BooleanQuery)dis);
|
||||||
U.setMinShouldMatch(t, minShouldMatch);
|
SolrPluginUtils.setMinShouldMatch(t, minShouldMatch);
|
||||||
parsedUserQuery = t;
|
parsedUserQuery = t;
|
||||||
}
|
}
|
||||||
query.add(parsedUserQuery, BooleanClause.Occur.MUST);
|
query.add(parsedUserQuery, BooleanClause.Occur.MUST);
|
||||||
|
@ -175,8 +165,8 @@ class DismaxQParser extends QParser {
|
||||||
|
|
||||||
|
|
||||||
/* * * Boosting Query * * */
|
/* * * Boosting Query * * */
|
||||||
boostParams = solrParams.getParams(DMP.BQ);
|
boostParams = solrParams.getParams(DisMaxParams.BQ);
|
||||||
//List<Query> boostQueries = U.parseQueryStrings(req, boostParams);
|
//List<Query> boostQueries = SolrPluginUtils.parseQueryStrings(req, boostParams);
|
||||||
boostQueries=null;
|
boostQueries=null;
|
||||||
if (boostParams!=null && boostParams.length>0) {
|
if (boostParams!=null && boostParams.length>0) {
|
||||||
boostQueries = new ArrayList<Query>();
|
boostQueries = new ArrayList<Query>();
|
||||||
|
@ -209,7 +199,7 @@ class DismaxQParser extends QParser {
|
||||||
|
|
||||||
/* * * Boosting Functions * * */
|
/* * * Boosting Functions * * */
|
||||||
|
|
||||||
String[] boostFuncs = solrParams.getParams(DMP.BF);
|
String[] boostFuncs = solrParams.getParams(DisMaxParams.BF);
|
||||||
if (null != boostFuncs && 0 != boostFuncs.length) {
|
if (null != boostFuncs && 0 != boostFuncs.length) {
|
||||||
for (String boostFunc : boostFuncs) {
|
for (String boostFunc : boostFuncs) {
|
||||||
if(null == boostFunc || "".equals(boostFunc)) continue;
|
if(null == boostFunc || "".equals(boostFunc)) continue;
|
||||||
|
|
Loading…
Reference in New Issue