Skip to content

Apache Lucene open-source search software

SOLR-9996: Unstored IntPointField returns Long type

Ishan Chattopadhyaya69055aa4a82d
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c0fe5054c6e..748125a9d82 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -74,6 +74,8 @@ Optimizations
* SOLR-9584: Support Solr being proxied with another endpoint than default /solr, by using relative links
in AdminUI javascripts (Yun Jie Zhou via janhoy)
+* SOLR-9996: Unstored IntPointField returns Long type (Ishan Chattopadhyaya)
+
Other Changes
----------------------
* SOLR-8396: Add support for PointFields in Solr (Ishan Chattopadhyaya, Tomás Fernández Löbbe)
diff --git a/solr/core/src/java/org/apache/solr/schema/IntPointField.java b/solr/core/src/java/org/apache/solr/schema/IntPointField.java
index a7bab071ec7..2271282bacb 100644
--- a/solr/core/src/java/org/apache/solr/schema/IntPointField.java
+++ b/solr/core/src/java/org/apache/solr/schema/IntPointField.java
@@ -89,7 +89,7 @@ public class IntPointField extends PointField implements IntValueFieldType {
public Object toObject(IndexableField f) {
final Number val = f.numericValue();
if (val != null) {
- return val;
+ return val.intValue();
} else {
throw new AssertionError("Unexpected state. Field: '" + f + "'");
}
diff --git a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
index 12f15049c69..8fb69264893 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestPointFields.java
@@ -785,6 +785,11 @@ public class TestPointFields extends SolrTestCaseJ4 {
for (int i=0; i < values.length; i++) {
assertU(adoc("id", String.valueOf(i), field, values[i]));
}
+ // Check using RTG
+ for (int i = 0; i < values.length; i++) {
+ assertQ(req("qt", "/get", "id", String.valueOf(i)),
+ "//doc/" + type + "[@name='" + field + "'][.='" + values[i] + "']");
+ }
assertU(commit());
String[] expected = new String[values.length + 1];
expected[0] = "//*[@numFound='" + values.length + "']";
@@ -792,6 +797,12 @@ public class TestPointFields extends SolrTestCaseJ4 {
expected[i] = "//result/doc[" + i + "]/" + type + "[@name='" + field + "'][.='" + values[i-1] + "']";
}
assertQ(req("q", "*:*", "fl", "id, " + field, "rows", String.valueOf(values.length)), expected);
+
+ // Check using RTG
+ for (int i = 0; i < values.length; i++) {
+ assertQ(req("qt", "/get", "id", String.valueOf(i)),
+ "//doc/" + type + "[@name='" + field + "'][.='" + values[i] + "']");
+ }
}
private void doTestIntPointFieldRangeQuery(String fieldName, String type, boolean testLong) throws Exception {