mirror of
https://github.com/apache/lucene.git
synced 2025-02-09 11:35:14 +00:00
SOLR-5541: Use StrUtils.splitSmart to handle escape chars
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1565520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
132f389f2d
commit
3b997b7e52
@ -43,6 +43,7 @@ import org.apache.solr.cloud.ZkController;
|
|||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.params.QueryElevationParams;
|
import org.apache.solr.common.params.QueryElevationParams;
|
||||||
import org.apache.solr.common.params.SolrParams;
|
import org.apache.solr.common.params.SolrParams;
|
||||||
|
import org.apache.solr.common.util.StrUtils;
|
||||||
import org.apache.solr.schema.IndexSchema;
|
import org.apache.solr.schema.IndexSchema;
|
||||||
import org.apache.solr.search.grouping.GroupingSpecification;
|
import org.apache.solr.search.grouping.GroupingSpecification;
|
||||||
import org.apache.solr.util.DOMUtil;
|
import org.apache.solr.util.DOMUtil;
|
||||||
@ -339,18 +340,6 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
|
|||||||
elev.put(obj.analyzed, obj);
|
elev.put(obj.analyzed, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
ElevationObj getElevationObj(String query, String[] ids, String[] ex) throws IOException {
|
|
||||||
if (ids == null) {
|
|
||||||
ids = new String[0];
|
|
||||||
}
|
|
||||||
if (ex == null) {
|
|
||||||
ex = new String[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
ElevationObj obj = new ElevationObj(query, Arrays.asList(ids), Arrays.asList(ex));
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getAnalyzedQuery(String query) throws IOException {
|
String getAnalyzedQuery(String query) throws IOException {
|
||||||
if (analyzer == null) {
|
if (analyzer == null) {
|
||||||
return query;
|
return query;
|
||||||
@ -397,9 +386,9 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
|
|||||||
ElevationObj booster = null;
|
ElevationObj booster = null;
|
||||||
try {
|
try {
|
||||||
if(boostStr != null || exStr != null) {
|
if(boostStr != null || exStr != null) {
|
||||||
String[] boosts = (boostStr != null) ? boostStr.split(",") : new String[0];
|
List<String> boosts = (boostStr != null) ? StrUtils.splitSmart(boostStr,",", true) : new ArrayList<String>(0);
|
||||||
String[] excludes = (exStr != null) ? exStr.split(",") : new String[0];
|
List<String> excludes = (exStr != null) ? StrUtils.splitSmart(exStr, ",", true) : new ArrayList<String>(0);
|
||||||
booster = getElevationObj(qstr, boosts, excludes);
|
booster = new ElevationObj(qstr, boosts, excludes);
|
||||||
} else {
|
} else {
|
||||||
IndexReader reader = req.getSearcher().getIndexReader();
|
IndexReader reader = req.getSearcher().getIndexReader();
|
||||||
qstr = getAnalyzedQuery(qstr);
|
qstr = getAnalyzedQuery(qstr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user