mirror of https://github.com/apache/lucene.git
LUCENE-2712: Fix FieldBoostMapAttribute to not use CharSequence as a map key
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37fda0b1c1
commit
c711709168
|
@ -154,7 +154,11 @@ API Changes
|
|||
|
||||
* LUCENE-2626: FastVectorHighlighter: enable FragListBuilder and FragmentsBuilder
|
||||
to be set per-field override. (Koji Sekiguchi)
|
||||
|
||||
|
||||
* LUCENE-2712: FieldBoostMapAttribute in contrib/queryparser was changed from
|
||||
a Map<CharSequence,Float> to a Map<String,Float>. Per the CharSequence javadoc,
|
||||
CharSequence is inappropriate as a map key. (Robert Muir)
|
||||
|
||||
New features
|
||||
|
||||
* LUCENE-2306: Add NumericRangeFilter and NumericRangeQuery support to XMLQueryParser.
|
||||
|
|
|
@ -74,8 +74,7 @@ public class MultiFieldQueryParserWrapper extends QueryParserWrapper {
|
|||
* what fields they appear.
|
||||
* </p>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer, Map boosts) {
|
||||
public MultiFieldQueryParserWrapper(String[] fields, Analyzer analyzer, Map<String, Float> boosts) {
|
||||
this(fields, analyzer);
|
||||
StandardQueryParser qpHelper = getQueryParserHelper();
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.apache.lucene.queryParser.standard.config.RangeCollatorAttribute;
|
|||
import org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler;
|
||||
import org.apache.lucene.queryParser.standard.parser.StandardSyntaxParser;
|
||||
import org.apache.lucene.queryParser.standard.processors.StandardQueryNodeProcessorPipeline;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.FuzzyQuery;
|
||||
import org.apache.lucene.search.MultiTermQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
|
@ -462,8 +463,7 @@ public class QueryParserWrapper {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Query getBooleanQuery(List clauses, boolean disableCoord)
|
||||
protected Query getBooleanQuery(List<BooleanClause> clauses, boolean disableCoord)
|
||||
throws ParseException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ public class StandardQueryParser extends QueryParserHelper {
|
|||
attr.setFuzzyMinSimilarity(fuzzyMinSim);
|
||||
}
|
||||
|
||||
public void setFieldsBoost(Map<CharSequence, Float> boosts) {
|
||||
public void setFieldsBoost(Map<String, Float> boosts) {
|
||||
FieldBoostMapAttribute attr = getQueryConfigHandler().addAttribute(FieldBoostMapAttribute.class);
|
||||
attr.setFieldBoostMap(boosts);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,6 @@ public interface FieldBoostMapAttribute extends Attribute {
|
|||
/**
|
||||
* @param boosts a mapping from field name to its default boost
|
||||
*/
|
||||
public void setFieldBoostMap(Map<CharSequence, Float> boosts);
|
||||
public Map<CharSequence, Float> getFieldBoostMap();
|
||||
public void setFieldBoostMap(Map<String, Float> boosts);
|
||||
public Map<String, Float> getFieldBoostMap();
|
||||
}
|
||||
|
|
|
@ -38,18 +38,18 @@ public class FieldBoostMapAttributeImpl extends AttributeImpl
|
|||
|
||||
private static final long serialVersionUID = -2104763012523049527L;
|
||||
|
||||
private Map<CharSequence, Float> boosts = new LinkedHashMap<CharSequence, Float>();
|
||||
private Map<String, Float> boosts = new LinkedHashMap<String, Float>();
|
||||
|
||||
|
||||
public FieldBoostMapAttributeImpl() {
|
||||
// empty constructor
|
||||
}
|
||||
|
||||
public void setFieldBoostMap(Map<CharSequence, Float> boosts) {
|
||||
public void setFieldBoostMap(Map<String, Float> boosts) {
|
||||
this.boosts = boosts;
|
||||
}
|
||||
|
||||
public Map<CharSequence, Float> getFieldBoostMap() {
|
||||
public Map<String, Float> getFieldBoostMap() {
|
||||
return this.boosts;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ public class TestMultiFieldQPHelper extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public void testBoostsSimple() throws Exception {
|
||||
Map<CharSequence,Float> boosts = new HashMap<CharSequence,Float>();
|
||||
Map<String,Float> boosts = new HashMap<String,Float>();
|
||||
boosts.put("b", Float.valueOf(5));
|
||||
boosts.put("t", Float.valueOf(10));
|
||||
String[] fields = { "b", "t" };
|
||||
|
|
|
@ -144,7 +144,7 @@ public class TestMultiFieldQueryParserWrapper extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public void testBoostsSimple() throws Exception {
|
||||
Map<CharSequence,Float> boosts = new HashMap<CharSequence,Float>();
|
||||
Map<String,Float> boosts = new HashMap<String,Float>();
|
||||
boosts.put("b", Float.valueOf(5));
|
||||
boosts.put("t", Float.valueOf(10));
|
||||
String[] fields = { "b", "t" };
|
||||
|
|
Loading…
Reference in New Issue