You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2010/10/18 04:54:21 UTC
svn commit: r1023637 - in /lucene/dev/trunk/lucene/contrib: ./
queryparser/src/java/org/apache/lucene/queryParser/standard/
queryparser/src/java/org/apache/lucene/queryParser/standard/config/
queryparser/src/test/org/apache/lucene/queryParser/standard/
Author: rmuir
Date: Mon Oct 18 02:54:20 2010
New Revision: 1023637
URL: http://svn.apache.org/viewvc?rev=1023637&view=rev
Log:
LUCENE-2712: Fix FieldBoostMapAttribute to not use CharSequence as a map key
Modified:
lucene/dev/trunk/lucene/contrib/CHANGES.txt
lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java
lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java
lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java
lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttribute.java
lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java
lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java
lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java
Modified: lucene/dev/trunk/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/CHANGES.txt?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/contrib/CHANGES.txt Mon Oct 18 02:54:20 2010
@@ -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.
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/MultiFieldQueryParserWrapper.java Mon Oct 18 02:54:20 2010
@@ -74,8 +74,7 @@ public class MultiFieldQueryParserWrappe
* 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();
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/QueryParserWrapper.java Mon Oct 18 02:54:20 2010
@@ -49,6 +49,7 @@ import org.apache.lucene.queryParser.sta
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();
}
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/StandardQueryParser.java Mon Oct 18 02:54:20 2010
@@ -413,7 +413,7 @@ public class StandardQueryParser extends
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);
}
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttribute.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttribute.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttribute.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttribute.java Mon Oct 18 02:54:20 2010
@@ -30,6 +30,6 @@ public interface FieldBoostMapAttribute
/**
* @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();
}
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/config/FieldBoostMapAttributeImpl.java Mon Oct 18 02:54:20 2010
@@ -38,18 +38,18 @@ public class FieldBoostMapAttributeImpl
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;
}
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQPHelper.java Mon Oct 18 02:54:20 2010
@@ -143,7 +143,7 @@ public class TestMultiFieldQPHelper exte
}
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" };
Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java?rev=1023637&r1=1023636&r2=1023637&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java Mon Oct 18 02:54:20 2010
@@ -144,7 +144,7 @@ public class TestMultiFieldQueryParserWr
}
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" };