You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2016/04/18 13:10:30 UTC

lucene-solr:master: LUCENE-7219: Make queryparser/xml (Point|LegacyNumeric)RangeQuery builders match the underlying queries' (lower|upper)Term optionality logic. (Kaneshanathan Srivisagan, Christine Poerschke)

Repository: lucene-solr
Updated Branches:
  refs/heads/master 9a1880aee -> c57db0258


LUCENE-7219: Make queryparser/xml (Point|LegacyNumeric)RangeQuery builders match the underlying queries' (lower|upper)Term optionality logic. (Kaneshanathan Srivisagan, Christine Poerschke)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c57db025
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c57db025
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c57db025

Branch: refs/heads/master
Commit: c57db02580580d42be8e4e08e96c278c878e9d2a
Parents: 9a1880a
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Apr 18 09:58:38 2016 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Mon Apr 18 12:09:31 2016 +0100

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |  4 +++
 .../LegacyNumericRangeQueryBuilder.java         | 36 ++++++++++++--------
 .../xml/builders/PointRangeQueryBuilder.java    | 28 +++++++++------
 .../LegacyNumericRangeQueryWithoutLowerTerm.xml | 31 +++++++++++++++++
 .../xml/LegacyNumericRangeQueryWithoutRange.xml | 31 +++++++++++++++++
 .../LegacyNumericRangeQueryWithoutUpperTerm.xml | 31 +++++++++++++++++
 .../xml/PointRangeQueryWithoutLowerTerm.xml     | 31 +++++++++++++++++
 .../xml/PointRangeQueryWithoutRange.xml         | 31 +++++++++++++++++
 .../xml/PointRangeQueryWithoutUpperTerm.xml     | 31 +++++++++++++++++
 .../lucene/queryparser/xml/TestCoreParser.java  | 30 ++++++++++++++++
 10 files changed, 260 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index d7e1b39..d00972b 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -84,6 +84,10 @@ Bug Fixes
   that led to IllegalStateException being thrown when nothing was wrong.
   (David Smiley, yonik)  
 
+* LUCENE-7219: Make queryparser/xml (Point|LegacyNumeric)RangeQuery builders
+  match the underlying queries' (lower|upper)Term optionality logic.
+  (Kaneshanathan Srivisagan, Christine Poerschke)
+
 Documentation
 
 * LUCENE-7223: Improve XXXPoint javadocs to make it clear that you

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java
index e195964..f7aef3f 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/LegacyNumericRangeQueryBuilder.java
@@ -45,14 +45,14 @@ import org.w3c.dom.Element;
  * <tr>
  * <td>lowerTerm</td>
  * <td>Specified by <tt>type</tt></td>
- * <td>Yes</td>
- * <td>N/A</td>
+ * <td>No</td>
+ * <td>Null</td>
  * </tr>
  * <tr>
  * <td>upperTerm</td>
  * <td>Specified by <tt>type</tt></td>
- * <td>Yes</td>
- * <td>N/A</td>
+ * <td>No</td>
+ * <td>Null</td>
  * </tr>
  * <tr>
  * <td>type</td>
@@ -91,8 +91,8 @@ public class LegacyNumericRangeQueryBuilder implements QueryBuilder {
   @Override
   public Query getQuery(Element e) throws ParserException {
     String field = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
-    String lowerTerm = DOMUtils.getAttributeOrFail(e, "lowerTerm");
-    String upperTerm = DOMUtils.getAttributeOrFail(e, "upperTerm");
+    final String lowerTerm = DOMUtils.getAttribute(e, "lowerTerm", null);
+    final String upperTerm = DOMUtils.getAttribute(e, "upperTerm", null);
     boolean lowerInclusive = DOMUtils.getAttribute(e, "includeLower", true);
     boolean upperInclusive = DOMUtils.getAttribute(e, "includeUpper", true);
     int precisionStep = DOMUtils.getAttribute(e, "precisionStep", LegacyNumericUtils.PRECISION_STEP_DEFAULT);
@@ -101,20 +101,28 @@ public class LegacyNumericRangeQueryBuilder implements QueryBuilder {
     try {
       Query filter;
       if (type.equalsIgnoreCase("int")) {
-        filter = LegacyNumericRangeQuery.newIntRange(field, precisionStep, Integer
-                .valueOf(lowerTerm), Integer.valueOf(upperTerm), lowerInclusive,
+        filter = LegacyNumericRangeQuery.newIntRange(field, precisionStep,
+            (lowerTerm == null ? null : Integer.valueOf(lowerTerm)),
+            (upperTerm == null ? null : Integer.valueOf(upperTerm)),
+            lowerInclusive,
             upperInclusive);
       } else if (type.equalsIgnoreCase("long")) {
-        filter = LegacyNumericRangeQuery.newLongRange(field, precisionStep, Long
-                .valueOf(lowerTerm), Long.valueOf(upperTerm), lowerInclusive,
+        filter = LegacyNumericRangeQuery.newLongRange(field, precisionStep,
+            (lowerTerm == null ? null : Long.valueOf(lowerTerm)),
+            (upperTerm == null ? null : Long.valueOf(upperTerm)),
+            lowerInclusive,
             upperInclusive);
       } else if (type.equalsIgnoreCase("double")) {
-        filter = LegacyNumericRangeQuery.newDoubleRange(field, precisionStep, Double
-                .valueOf(lowerTerm), Double.valueOf(upperTerm), lowerInclusive,
+        filter = LegacyNumericRangeQuery.newDoubleRange(field, precisionStep,
+            (lowerTerm == null ? null : Double.valueOf(lowerTerm)),
+            (upperTerm == null ? null : Double.valueOf(upperTerm)),
+            lowerInclusive,
             upperInclusive);
       } else if (type.equalsIgnoreCase("float")) {
-        filter = LegacyNumericRangeQuery.newFloatRange(field, precisionStep, Float
-                .valueOf(lowerTerm), Float.valueOf(upperTerm), lowerInclusive,
+        filter = LegacyNumericRangeQuery.newFloatRange(field, precisionStep,
+            (lowerTerm == null ? null : Float.valueOf(lowerTerm)),
+            (upperTerm == null ? null : Float.valueOf(upperTerm)),
+            lowerInclusive,
             upperInclusive);
       } else {
         throw new ParserException("type attribute must be one of: [long, int, double, float]");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/PointRangeQueryBuilder.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/PointRangeQueryBuilder.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/PointRangeQueryBuilder.java
index 4548316..82f7039 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/PointRangeQueryBuilder.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/PointRangeQueryBuilder.java
@@ -46,14 +46,14 @@ import org.w3c.dom.Element;
  * <tr>
  * <td>lowerTerm</td>
  * <td>Specified by <tt>type</tt></td>
- * <td>Yes</td>
- * <td>N/A</td>
+ * <td>No</td>
+ * <td>Integer.MIN_VALUE Long.MIN_VALUE Float.NEGATIVE_INFINITY Double.NEGATIVE_INFINITY</td>
  * </tr>
  * <tr>
  * <td>upperTerm</td>
  * <td>Specified by <tt>type</tt></td>
- * <td>Yes</td>
- * <td>N/A</td>
+ * <td>No</td>
+ * <td>Integer.MAX_VALUE Long.MAX_VALUE Float.POSITIVE_INFINITY Double.POSITIVE_INFINITY</td>
  * </tr>
  * <tr>
  * <td>type</td>
@@ -72,19 +72,27 @@ public class PointRangeQueryBuilder implements QueryBuilder {
   @Override
   public Query getQuery(Element e) throws ParserException {
     String field = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName");
-    String lowerTerm = DOMUtils.getAttributeOrFail(e, "lowerTerm");
-    String upperTerm = DOMUtils.getAttributeOrFail(e, "upperTerm");
+    final String lowerTerm = DOMUtils.getAttribute(e, "lowerTerm", null);
+    final String upperTerm = DOMUtils.getAttribute(e, "upperTerm", null);
 
     String type = DOMUtils.getAttribute(e, "type", "int");
     try {
       if (type.equalsIgnoreCase("int")) {
-        return IntPoint.newRangeQuery(field, Integer.valueOf(lowerTerm), Integer.valueOf(upperTerm));
+        return IntPoint.newRangeQuery(field,
+            (lowerTerm == null ? Integer.MIN_VALUE : Integer.valueOf(lowerTerm)),
+            (upperTerm == null ? Integer.MAX_VALUE : Integer.valueOf(upperTerm)));
       } else if (type.equalsIgnoreCase("long")) {
-        return LongPoint.newRangeQuery(field, Long.valueOf(lowerTerm), Long.valueOf(upperTerm));
+        return LongPoint.newRangeQuery(field,
+            (lowerTerm == null ? Long.MIN_VALUE : Long.valueOf(lowerTerm)),
+            (upperTerm == null ? Long.MAX_VALUE : Long.valueOf(upperTerm)));
       } else if (type.equalsIgnoreCase("double")) {
-        return DoublePoint.newRangeQuery(field, Double.valueOf(lowerTerm), Double.valueOf(upperTerm));
+        return DoublePoint.newRangeQuery(field,
+            (lowerTerm == null ? Double.NEGATIVE_INFINITY : Double.valueOf(lowerTerm)),
+            (upperTerm == null ? Double.POSITIVE_INFINITY : Double.valueOf(upperTerm)));
       } else if (type.equalsIgnoreCase("float")) {
-        return FloatPoint.newRangeQuery(field, Float.valueOf(lowerTerm), Float.valueOf(upperTerm));
+        return FloatPoint.newRangeQuery(field,
+            (lowerTerm == null ? Float.NEGATIVE_INFINITY : Float.valueOf(lowerTerm)),
+            (upperTerm == null ? Float.POSITIVE_INFINITY : Float.valueOf(upperTerm)));
       } else {
         throw new ParserException("type attribute must be one of: [long, int, double, float]");
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutLowerTerm.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutLowerTerm.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutLowerTerm.xml
new file mode 100644
index 0000000..54de55f
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutLowerTerm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <LegacyNumericRangeQuery fieldName="date2" upperTerm="19870412"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutRange.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutRange.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutRange.xml
new file mode 100644
index 0000000..764f654
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutRange.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <LegacyNumericRangeQuery fieldName="date2"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutUpperTerm.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutUpperTerm.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutUpperTerm.xml
new file mode 100644
index 0000000..d3a61c1
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/LegacyNumericRangeQueryWithoutUpperTerm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <LegacyNumericRangeQuery fieldName="date2" lowerTerm="19870409"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutLowerTerm.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutLowerTerm.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutLowerTerm.xml
new file mode 100644
index 0000000..2159c2c
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutLowerTerm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <PointRangeQuery fieldName="date3" upperTerm="19870412"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutRange.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutRange.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutRange.xml
new file mode 100644
index 0000000..dc18953
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutRange.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <PointRangeQuery fieldName="date3"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutUpperTerm.xml
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutUpperTerm.xml b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutUpperTerm.xml
new file mode 100644
index 0000000..eca8573
--- /dev/null
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/PointRangeQueryWithoutUpperTerm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<BooleanQuery fieldName="contents">
+  <Clause occurs="should">
+    <TermQuery>merger</TermQuery>
+  </Clause>
+  <Clause occurs="mustnot">
+    <TermQuery >sumitomo</TermQuery>    
+  </Clause>
+  <Clause occurs="must">
+    <TermQuery>bank</TermQuery>
+  </Clause>
+  <Clause occurs="must">
+    <PointRangeQuery fieldName="date3" lowerTerm="19870409"/>
+  </Clause>
+</BooleanQuery>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c57db025/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
index 82426d0..4cf5fcf 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestCoreParser.java
@@ -132,12 +132,42 @@ public class TestCoreParser extends LuceneTestCase {
     Query q = parse("LegacyNumericRangeQuery.xml");
     dumpResults("LegacyNumericRangeQuery", q, 5);
   }
+
+  public void testNumericRangeQueryXMLWithoutLowerTerm() throws ParserException, IOException {
+    Query q = parse("LegacyNumericRangeQueryWithoutLowerTerm.xml");
+    dumpResults("LegacyNumericRangeQueryWithoutLowerTerm", q, 5);
+  }
+
+  public void testNumericRangeQueryXMLWithoutUpperTerm() throws ParserException, IOException {
+    Query q = parse("LegacyNumericRangeQueryWithoutUpperTerm.xml");
+    dumpResults("LegacyNumericRangeQueryWithoutUpperTerm", q, 5);
+  }
+
+  public void testNumericRangeQueryXMLWithoutRange() throws ParserException, IOException {
+    Query q = parse("LegacyNumericRangeQueryWithoutRange.xml");
+    dumpResults("LegacyNumericRangeQueryWithoutRange", q, 5);
+  }
   
   public void testPointRangeQuery() throws ParserException, IOException {
     Query q = parse("PointRangeQuery.xml");
     dumpResults("PointRangeQuery", q, 5);
   }
 
+  public void testPointRangeQueryWithoutLowerTerm() throws ParserException, IOException {
+    Query q = parse("PointRangeQueryWithoutLowerTerm.xml");
+    dumpResults("PointRangeQueryWithoutLowerTerm", q, 5);
+  }
+
+  public void testPointRangeQueryWithoutUpperTerm() throws ParserException, IOException {
+    Query q = parse("PointRangeQueryWithoutUpperTerm.xml");
+    dumpResults("PointRangeQueryWithoutUpperTerm", q, 5);
+  }
+
+  public void testPointRangeQueryWithoutRange() throws ParserException, IOException {
+    Query q = parse("PointRangeQueryWithoutRange.xml");
+    dumpResults("PointRangeQueryWithoutRange", q, 5);
+  }
+
   //================= Helper methods ===================================
 
   protected String defaultField() {