LUCENE-3045: QueryNodeImpl.containsTag(String) should lowercase the tag key

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1096983 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adriano Crestani Campos 2011-04-27 02:49:17 +00:00
parent 3dd0b7f278
commit 5432f9de62
3 changed files with 21 additions and 1 deletions

View File

@ -42,11 +42,19 @@ API Changes
Instead, use SimilarityProvider to return different SweetSpotSimilaritys Instead, use SimilarityProvider to return different SweetSpotSimilaritys
for different fields, this way all parameters (such as TF factors) can be for different fields, this way all parameters (such as TF factors) can be
customized on a per-field basis. (Robert Muir) customized on a per-field basis. (Robert Muir)
Bug Fixes
* LUCENE-3045: fixed QueryNodeImpl.containsTag(String key) that was
not lowercasing the key before checking for the tag (Adriano Crestani)
======================= Lucene 3.x (not yet released) ======================= ======================= Lucene 3.x (not yet released) =======================
Bug Fixes Bug Fixes
* LUCENE-3045: fixed QueryNodeImpl.containsTag(String key) that was
not lowercasing the key before checking for the tag (Adriano Crestani)
* LUCENE-3026: SmartChineseAnalyzer's WordTokenFilter threw NullPointerException * LUCENE-3026: SmartChineseAnalyzer's WordTokenFilter threw NullPointerException
on sentences longer than 32,767 characters. (wangzhenghang via Robert Muir) on sentences longer than 32,767 characters. (wangzhenghang via Robert Muir)

View File

@ -160,7 +160,7 @@ public abstract class QueryNodeImpl implements QueryNode, Cloneable {
/** verify if a node contains a tag */ /** verify if a node contains a tag */
public boolean containsTag(String tagName) { public boolean containsTag(String tagName) {
return this.tags.containsKey(tagName); return this.tags.containsKey(tagName.toLowerCase());
} }
public Object getTag(String tagName) { public Object getTag(String tagName) {

View File

@ -32,4 +32,16 @@ public class TestQueryNode extends LuceneTestCase {
bq.add(Arrays.asList(nodeB)); bq.add(Arrays.asList(nodeB));
assertEquals(2, bq.getChildren().size()); assertEquals(2, bq.getChildren().size());
} }
/* LUCENE-3045 bug in QueryNodeImpl.containsTag(String key)*/
public void testTags() throws Exception {
QueryNode node = new FieldQueryNode("foo", "A", 0, 1);
node.setTag("TaG", new Object());
assertTrue(node.getTagMap().size() > 0);
assertTrue(node.containsTag("tAg"));
assertTrue(node.getTag("tAg") != null);
}
} }