You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2016/10/17 05:44:09 UTC
[1/3] lucene-solr:jira/solr-8396: Added FloatPointField.
Repository: lucene-solr
Updated Branches:
refs/heads/jira/solr-8396 5fa22ceca -> f4c68cddb
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
index 66c378d..d69c1f8 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerTest.java
@@ -22,6 +22,7 @@ import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.CustomAnalyzerStrField; // jdoc
import org.apache.solr.util.AbstractSolrTestCase;
import org.apache.solr.util.TestHarness;
+import org.apache.solr.SolrTestCaseJ4.SuppressPointFields;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -32,6 +33,7 @@ import java.util.EnumSet;
/**
* :TODO: currently only tests some of the utilities in the LukeRequestHandler
*/
+@SuppressPointFields
public class LukeRequestHandlerTest extends AbstractSolrTestCase {
@BeforeClass
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index 504f241..1f210f3 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -456,13 +456,15 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|| (!PREFER_POINT_FIELDS && random().nextBoolean())) {
log.info("Using TrieFields");
System.setProperty("solr.tests.intClass", "int");
- System.setProperty("solr.tests.doubleClass", "double");
System.setProperty("solr.tests.longClass", "long");
+ System.setProperty("solr.tests.doubleClass", "double");
+ System.setProperty("solr.tests.floatClass", "float");
} else {
log.info("Using PointFields");
System.setProperty("solr.tests.intClass", "pint");
- System.setProperty("solr.tests.doubleClass", "pdouble");
System.setProperty("solr.tests.longClass", "plong");
+ System.setProperty("solr.tests.doubleClass", "pdouble");
+ System.setProperty("solr.tests.floatClass", "pfloat");
}
}
[2/3] lucene-solr:jira/solr-8396: Added FloatPointField.
Posted by tf...@apache.org.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test/org/apache/solr/TestPointFields.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/TestPointFields.java b/solr/core/src/test/org/apache/solr/TestPointFields.java
index de6c47e..d39a303 100644
--- a/solr/core/src/test/org/apache/solr/TestPointFields.java
+++ b/solr/core/src/test/org/apache/solr/TestPointFields.java
@@ -66,6 +66,674 @@ public class TestPointFields extends SolrTestCaseJ4 {
// doTestIntPointFieldExactQuery("number_p_i_ni_mv_dv", false);
}
+ @Test
+ public void testIntPointFieldReturn() throws Exception {
+ testPointFieldReturn("number_p_i", "int", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99"});
+ clearIndex();
+ assertU(commit());
+ testPointFieldReturn("number_p_i_dv_ns", "int", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99"});
+ }
+
+ @Test
+ public void testIntPointFieldRangeQuery() throws Exception {
+ doTestIntPointFieldRangeQuery("number_p_i", "int", false);
+ }
+
+ @Test
+ public void testIntPointFieldSort() throws Exception {
+ doTestPointFieldSort("number_p_i", "number_p_i_dv", new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"});
+ }
+
+ @Test
+ public void testIntPointFieldFacetField() throws Exception {
+ testPointFieldFacetField("number_p_i", "number_p_i_dv", getSequentialStringArrayWithInts(10));
+ }
+
+ @Test
+ public void testIntPointFieldRangeFacet() throws Exception {
+ doTestIntPointFieldRangeFacet("number_p_i_dv", "number_p_i");
+ }
+
+
+ @Test
+ public void testIntPointFunctionQuery() throws Exception {
+ doTestIntPointFunctionQuery("number_p_i_dv", "number_p_i", "int");
+ }
+
+
+ @Test
+ public void testIntPointStats() throws Exception {
+ testPointStats("number_p_i", "number_p_i_dv", new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"},
+ 0D, 9D, "10", "1", 0D);
+ }
+
+ @Test
+ public void testIntPointGrouping() throws Exception {
+ // nocommit: Implement or remove
+ }
+
+ @Test
+ public void testIntPointPivotFaceting() throws Exception {
+ // nocommit: Implement or remove
+ }
+
+ @Test
+ public void testIntPointFieldMultiValuedExactQuery() throws Exception {
+ testPointFieldMultiValuedExactQuery("number_p_i_mv", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testIntPointFieldMultiValuedReturn() throws Exception {
+ testPointFieldMultiValuedReturn("number_p_i_mv", "int", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testIntPointFieldMultiValuedRangeQuery() throws Exception {
+ testPointFieldMultiValuedRangeQuery("number_p_i_mv", "int", getSequentialStringArrayWithInts(20));
+ }
+
+ //TODO MV SORT?
+ @Test
+ @Ignore
+ public void testIntPointFieldMultiValuedFacetField() throws Exception {
+ testPointFieldMultiValuedFacetField("number_p_i_mv", "number_p_i_mv_dv", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ @Ignore
+ public void testIntPointFieldMultiValuedRangeFacet() throws Exception {
+ String docValuesField = "number_p_i_mv_dv";
+ String nonDocValuesField = "number_p_i_mv";
+
+ for (int i = 0; i < 10; i++) {
+ assertU(adoc("id", String.valueOf(i), docValuesField, String.valueOf(i), docValuesField, String.valueOf(i + 10),
+ nonDocValuesField, String.valueOf(i), nonDocValuesField, String.valueOf(i + 10)));
+ }
+ assertU(commit());
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof IntPointField);
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "0", "facet.range.end", "20", "facet.range.gap", "100"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='10']");
+
+ assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof IntPointField);
+ // Range Faceting with method = filter should work
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "filter"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+
+ // this should actually use filter method instead of dv
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+ }
+
+// private boolean dvIsRandomAccessOrds(String field) throws IOException {
+// RefCounted<SolrIndexSearcher> ref = null;
+// try {
+// ref = h.getCore().getSearcher();
+// SortedSetDocValues values = DocValues.getSortedSet(ref.get().getIndexReader().leaves().get(0).reader(), field);
+// return values instanceof RandomAccessOrds;
+// } finally {
+// if (ref != null) ref.decref();
+// }
+// }
+
+ @Test
+ @Ignore
+ public void testIntPointMultiValuedFunctionQuery() throws Exception {
+ testPointMultiValuedFunctionQuery("number_p_i_mv", "number_p_i_mv_dv", "int", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testIntPointFieldsAtomicUpdates() throws Exception {
+ if (!Boolean.getBoolean("enable.update.log")) {
+ return;
+ }
+ testIntPointFieldsAtomicUpdates("number_p_i", "int");
+ testIntPointFieldsAtomicUpdates("number_p_i_dv", "int");
+ testIntPointFieldsAtomicUpdates("number_p_i_dv_ns", "int");
+ }
+
+ // DoublePointField
+
+ @Test
+ public void testDoublePointFieldExactQuery() throws Exception {
+ doTestFloatPointFieldExactQuery("number_d");
+ doTestFloatPointFieldExactQuery("number_p_d");
+ doTestFloatPointFieldExactQuery("number_p_d_mv");
+ doTestFloatPointFieldExactQuery("number_p_d_ni_dv");
+// doTestFloatPointFieldExactQuery("number_p_d_ni_mv_dv");
+ }
+
+ @Test
+ public void testDoublePointFieldReturn() throws Exception {
+ testPointFieldReturn("number_p_d", "double", new String[]{"0.0", "1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
+ clearIndex();
+ assertU(commit());
+ testPointFieldReturn("number_p_d_dv_ns", "double", new String[]{"0.0", "1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
+ clearIndex();
+ assertU(commit());
+ String[] arr = new String[atLeast(10)];
+ for (int i = 0; i < arr.length; i++) {
+ double rand = random().nextDouble() * 10;
+ arr[i] = String.valueOf(rand);
+ }
+ testPointFieldReturn("number_p_d", "double", arr);
+ }
+
+ @Test
+ public void testDoublePointFieldRangeQuery() throws Exception {
+ doTestFloatPointFieldRangeQuery("number_p_d", "double", true);
+ }
+
+ @Test
+ public void testDoublePointFieldSort() throws Exception {
+ String[] arr = getRandomStringArrayWithDoubles(10, true);
+ doTestPointFieldSort("number_p_d", "number_p_d_dv", arr);
+ }
+
+ @Test
+ public void testDoublePointFieldFacetField() throws Exception {
+ testPointFieldFacetField("number_p_d", "number_p_d_dv", getSequentialStringArrayWithDoubles(10));
+ clearIndex();
+ assertU(commit());
+ testPointFieldFacetField("number_p_d", "number_p_d_dv", getRandomStringArrayWithDoubles(10, false));
+ }
+
+ @Test
+ public void testDoublePointFieldRangeFacet() throws Exception {
+ doTestFloatPointFieldRangeFacet("number_p_d_dv", "number_p_d");
+ }
+
+ @Test
+ public void testDoublePointFunctionQuery() throws Exception {
+ doTestFloatPointFunctionQuery("number_p_d_dv", "number_p_d", "double");
+ }
+
+ @Test
+ public void testDoublePointStats() throws Exception {
+ testPointStats("number_p_d", "number_p_d_dv", new String[]{"-10.0", "1.1", "2.2", "3.3", "4.4", "5.5", "6.6", "7.7", "8.8", "9.9"},
+ -10.0D, 9.9D, "10", "1", 1E-10D);
+ }
+
+ @Test
+ public void testDoublePointFieldMultiValuedExactQuery() throws Exception {
+ testPointFieldMultiValuedExactQuery("number_p_d_mv", getRandomStringArrayWithDoubles(20, false));
+ }
+
+ @Test
+ public void testDoublePointFieldMultiValuedReturn() throws Exception {
+ testPointFieldMultiValuedReturn("number_p_d_mv", "double", getSequentialStringArrayWithDoubles(20));
+ }
+
+ @Test
+ public void testDoublePointFieldMultiValuedRangeQuery() throws Exception {
+ testPointFieldMultiValuedRangeQuery("number_p_d_mv", "double", getSequentialStringArrayWithDoubles(20));
+ }
+
+ @Test
+ @Ignore
+ public void testDoublePointFieldMultiValuedFacetField() throws Exception {
+ testPointFieldMultiValuedFacetField("number_p_d_mv", "number_p_d_mv_dv", getSequentialStringArrayWithDoubles(20));
+ testPointFieldMultiValuedFacetField("number_p_d_mv", "number_p_d_mv_dv", getRandomStringArrayWithDoubles(20, false));
+ }
+
+ @Test
+ @Ignore
+ public void testDoublePointFieldMultiValuedRangeFacet() throws Exception {
+ String docValuesField = "number_p_d_mv_dv";
+ String nonDocValuesField = "number_p_d_mv";
+
+ for (int i = 0; i < 10; i++) {
+ assertU(adoc("id", String.valueOf(i), docValuesField, String.valueOf(i), docValuesField, String.valueOf(i + 10),
+ nonDocValuesField, String.valueOf(i), nonDocValuesField, String.valueOf(i + 10)));
+ }
+ assertU(commit());
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).multiValued());
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof DoublePointField);
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
+
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
+
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "0", "facet.range.end", "20", "facet.range.gap", "100"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='10']");
+
+ assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).multiValued());
+ assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof DoublePointField);
+ // Range Faceting with method = filter should work
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "filter"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
+
+ // this should actually use filter method instead of dv
+ assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
+ }
+
+ @Test
+ @Ignore
+ public void testDoublePointMultiValuedFunctionQuery() throws Exception {
+ testPointMultiValuedFunctionQuery("number_p_d_mv", "number_p_d_mv_dv", "double", getSequentialStringArrayWithDoubles(20));
+ testPointMultiValuedFunctionQuery("number_p_d_mv", "number_p_d_mv_dv", "double", getRandomStringArrayWithFloats(20, true));
+ }
+
+ @Test
+ public void testDoublePointFieldsAtomicUpdates() throws Exception {
+ if (!Boolean.getBoolean("enable.update.log")) {
+ return;
+ }
+ doTestFloatPointFieldsAtomicUpdates("number_p_d", "double");
+ doTestFloatPointFieldsAtomicUpdates("number_p_d_dv", "double");
+ doTestFloatPointFieldsAtomicUpdates("number_p_d_dv_ns", "double");
+ }
+
+ private void doTestFloatPointFieldsAtomicUpdates(String field, String type) throws Exception {
+ assertU(adoc(sdoc("id", "1", field, "1.1234")));
+ assertU(commit());
+
+ assertU(adoc(sdoc("id", "1", field, ImmutableMap.of("inc", 1.1F))));
+ assertU(commit());
+
+ assertQ(req("q", "id:1"),
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.='2.2234']");
+
+ assertU(adoc(sdoc("id", "1", field, ImmutableMap.of("inc", -1.1F))));
+ assertU(commit());
+
+ // TODO: can this test be better?
+ assertQ(req("q", "id:1"),
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.>'1.1233']",
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.<'1.1235']");
+
+ assertU(adoc(sdoc("id", "1", field, ImmutableMap.of("set", 3.123F))));
+ assertU(commit());
+
+ assertQ(req("q", "id:1"),
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.='3.123']");
+
+ assertU(adoc(sdoc("id", "1", field, ImmutableMap.of("set", 3.14F))));
+ assertU(commit());
+ assertU(adoc(sdoc("id", "1", field, ImmutableMap.of("inc", 1F))));
+ assertU(commit());
+ assertQ(req("q", "id:1"),
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.>'4.13']",
+ "//result/doc[1]/" + type + "[@name='" + field + "'][.<'4.15']");
+ }
+
+ // Float
+
+
+ @Test
+ public void testFloatPointFieldExactQuery() throws Exception {
+ doTestFloatPointFieldExactQuery("number_p_f");
+ doTestFloatPointFieldExactQuery("number_p_f_mv");
+ doTestFloatPointFieldExactQuery("number_p_f_ni_dv");
+// doTestFloatPointFieldExactQuery("number_p_f_ni_mv_dv");
+ }
+
+ @Test
+ public void testFloatPointFieldReturn() throws Exception {
+ testPointFieldReturn("number_p_f", "float", new String[]{"0.0", "-1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
+ clearIndex();
+ assertU(commit());
+ testPointFieldReturn("number_p_f_dv_ns", "float", new String[]{"0.0", "-1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
+ clearIndex();
+ assertU(commit());
+ String[] arr = new String[atLeast(10)];
+ for (int i = 0; i < arr.length; i++) {
+ float rand = random().nextFloat() * 10;
+ arr[i] = String.valueOf(rand);
+ }
+ testPointFieldReturn("number_p_f", "float", arr);
+ }
+
+ @Test
+ public void testFloatPointFieldRangeQuery() throws Exception {
+ doTestFloatPointFieldRangeQuery("number_p_f", "float", false);
+ }
+
+ @Test
+ public void testFloatPointFieldSort() throws Exception {
+ String[] arr = getRandomStringArrayWithFloats(10, true);
+ doTestPointFieldSort("number_p_f", "number_p_f_dv", arr);
+ }
+
+ @Test
+ public void testFloatPointFieldFacetField() throws Exception {
+ testPointFieldFacetField("number_p_f", "number_p_f_dv", getSequentialStringArrayWithDoubles(10));
+ clearIndex();
+ assertU(commit());
+ testPointFieldFacetField("number_p_f", "number_p_f_dv", getRandomStringArrayWithFloats(10, false));
+ }
+
+ @Test
+ public void testFloatPointFieldRangeFacet() throws Exception {
+ doTestFloatPointFieldRangeFacet("number_p_f_dv", "number_p_f");
+ }
+
+ @Test
+ public void testFloatPointFunctionQuery() throws Exception {
+ doTestFloatPointFunctionQuery("number_p_f_dv", "number_p_f", "float");
+ }
+
+ @Test
+ public void testFloatPointStats() throws Exception {
+ testPointStats("number_p_f", "number_p_f_dv", new String[]{"-10.0", "1.1", "2.2", "3.3", "4.4", "5.5", "6.6", "7.7", "8.8", "9.9"},
+ -10D, 9.9D, "10", "1", 1E-6D);
+ }
+
+ @Test
+ public void testFloatPointFieldMultiValuedExactQuery() throws Exception {
+ testPointFieldMultiValuedExactQuery("number_p_f_mv", getRandomStringArrayWithFloats(20, false));
+ }
+
+ @Test
+ public void testFloatPointFieldMultiValuedReturn() throws Exception {
+ testPointFieldMultiValuedReturn("number_p_f_mv", "float", getSequentialStringArrayWithDoubles(20));
+ }
+
+ @Test
+ public void testFloatPointFieldMultiValuedRangeQuery() throws Exception {
+ testPointFieldMultiValuedRangeQuery("number_p_f_mv", "float", getSequentialStringArrayWithDoubles(20));
+ }
+
+ @Test
+ public void testFloatPointFieldsAtomicUpdates() throws Exception {
+ if (!Boolean.getBoolean("enable.update.log")) {
+ return;
+ }
+ doTestFloatPointFieldsAtomicUpdates("number_p_f", "float");
+ doTestFloatPointFieldsAtomicUpdates("number_p_f_dv", "float");
+ doTestFloatPointFieldsAtomicUpdates("number_p_f_dv_ns", "float");
+ }
+
+ // Long
+
+ @Test
+ public void testLongPointFieldExactQuery() throws Exception {
+ doTestIntPointFieldExactQuery("number_p_l", true);
+ doTestIntPointFieldExactQuery("number_p_l_mv", true);
+ doTestIntPointFieldExactQuery("number_p_l_ni_dv", true);
+// doTestIntPointFieldExactQuery("number_p_i_ni_mv_dv", true);
+ }
+
+ @Test
+ public void testLongPointFieldReturn() throws Exception {
+ testPointFieldReturn("number_p_l", "long", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99", String.valueOf(Long.MAX_VALUE)});
+ clearIndex();
+ assertU(commit());
+ testPointFieldReturn("number_p_l_dv_ns", "long", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99", String.valueOf(Long.MAX_VALUE)});
+ }
+
+ @Test
+ public void testLongPointFieldRangeQuery() throws Exception {
+ doTestIntPointFieldRangeQuery("number_p_l", "long", true);
+ }
+
+ @Test
+ public void testLongPointFieldSort() throws Exception {
+ doTestPointFieldSort("number_p_l", "number_p_l_dv", new String[]{String.valueOf(Integer.MIN_VALUE),
+ "1", "2", "3", "4", "5", "6", "7",
+ String.valueOf(Integer.MAX_VALUE), String.valueOf(Long.MAX_VALUE)});
+ }
+
+ @Test
+ public void testLongPointFieldFacetField() throws Exception {
+ testPointFieldFacetField("number_p_l", "number_p_l_dv", getSequentialStringArrayWithInts(10));
+ clearIndex();
+ assertU(commit());
+ testPointFieldFacetField("number_p_l", "number_p_l_dv", getRandomStringArrayWithLongs(10, true));
+ }
+
+ @Test
+ public void testLongPointFieldRangeFacet() throws Exception {
+ doTestIntPointFieldRangeFacet("number_p_l_dv", "number_p_l");
+ }
+
+ @Test
+ public void testLongPointFunctionQuery() throws Exception {
+ doTestIntPointFunctionQuery("number_p_l_dv", "number_p_l", "long");
+ }
+
+ @Test
+ public void testLongPointStats() throws Exception {
+ testPointStats("number_p_l", "number_p_l_dv", new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"},
+ 0D, 9D, "10", "1", 0D);
+ }
+
+ @Test
+ public void testLongPointFieldMultiValuedExactQuery() throws Exception {
+ testPointFieldMultiValuedExactQuery("number_p_l_mv", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testLongPointFieldMultiValuedReturn() throws Exception {
+ testPointFieldMultiValuedReturn("number_p_l_mv", "long", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testLongPointFieldMultiValuedRangeQuery() throws Exception {
+ testPointFieldMultiValuedRangeQuery("number_p_l_mv", "long", getSequentialStringArrayWithInts(20));
+ }
+
+ @Test
+ public void testLongPointFieldsAtomicUpdates() throws Exception {
+ if (!Boolean.getBoolean("enable.update.log")) {
+ return;
+ }
+ testIntPointFieldsAtomicUpdates("number_p_l", "long");
+ testIntPointFieldsAtomicUpdates("number_p_l_dv", "long");
+ testIntPointFieldsAtomicUpdates("number_p_l_dv_ns", "long");
+ }
+
+ // Helper methods
+
+ private String[] getRandomStringArrayWithDoubles(int length, boolean sorted) {
+ Set<Double> set;
+ if (sorted) {
+ set = new TreeSet<>();
+ } else {
+ set = new HashSet<>();
+ }
+ while (set.size() < length) {
+ double f = random().nextDouble() * (Double.MAX_VALUE/2);
+ if (random().nextBoolean()) {
+ f = f * -1;
+ }
+ set.add(f);
+ }
+ String[] stringArr = new String[length];
+ int i = 0;
+ for (double val:set) {
+ stringArr[i] = String.valueOf(val);
+ i++;
+ }
+ return stringArr;
+ }
+
+ private String[] getRandomStringArrayWithFloats(int length, boolean sorted) {
+ Set<Float> set;
+ if (sorted) {
+ set = new TreeSet<>();
+ } else {
+ set = new HashSet<>();
+ }
+ while (set.size() < length) {
+ float f = random().nextFloat() * (Float.MAX_VALUE/2);
+ if (random().nextBoolean()) {
+ f = f * -1;
+ }
+ set.add(f);
+ }
+ String[] stringArr = new String[length];
+ int i = 0;
+ for (float val:set) {
+ stringArr[i] = String.valueOf(val);
+ i++;
+ }
+ return stringArr;
+ }
+
+ private String[] getSequentialStringArrayWithInts(int length) {
+ String[] arr = new String[length];
+ for (int i = 0; i < length; i++) {
+ arr[i] = String.valueOf(i);
+ }
+ return arr;
+ }
+
+ private String[] getSequentialStringArrayWithDoubles(int length) {
+ String[] arr = new String[length];
+ for (int i = 0; i < length; i++) {
+ arr[i] = String.format(Locale.ROOT, "%d.0", i);
+ }
+ return arr;
+ }
+
+ private String[] getRandomStringArrayWithInts(int length, boolean sorted) {
+ Set<Integer> set;
+ if (sorted) {
+ set = new TreeSet<>();
+ } else {
+ set = new HashSet<>();
+ }
+ while (set.size() < length) {
+ int number = random().nextInt(100);
+ if (random().nextBoolean()) {
+ number = number * -1;
+ }
+ set.add(number);
+ }
+ String[] stringArr = new String[length];
+ int i = 0;
+ for (int val:set) {
+ stringArr[i] = String.valueOf(val);
+ i++;
+ }
+ return stringArr;
+ }
+
+ private String[] getRandomStringArrayWithLongs(int length, boolean sorted) {
+ Set<Long> set;
+ if (sorted) {
+ set = new TreeSet<>();
+ } else {
+ set = new HashSet<>();
+ }
+ while (set.size() < length) {
+ long number = random().nextLong();
+ if (random().nextBoolean()) {
+ number = number * -1;
+ }
+ set.add(number);
+ }
+ String[] stringArr = new String[length];
+ int i = 0;
+ for (long val:set) {
+ stringArr[i] = String.valueOf(val);
+ i++;
+ }
+ return stringArr;
+ }
+
private void doTestIntPointFieldExactQuery(String field, boolean testLong) throws Exception {
for (int i=0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), field, String.valueOf(i+1)));
@@ -103,15 +771,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
clearIndex();
assertU(commit());
}
-
- @Test
- public void testIntPointFieldReturn() throws Exception {
- testPointFieldReturn("number_p_i", "int", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99"});
- clearIndex();
- assertU(commit());
- testPointFieldReturn("number_p_i_dv_ns", "int", new String[]{"0", "-1", "2", "3", "43", "52", "-60", "74", "80", "99"});
- }
-
+
private void testPointFieldReturn(String field, String type, String[] values) throws Exception {
SchemaField sf = h.getCore().getLatestSchema().getField(field);
assert sf.stored() || (sf.hasDocValues() && sf.useDocValuesAsStored()):
@@ -127,12 +787,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
}
assertQ(req("q", "*:*", "fl", "id, " + field, "rows", String.valueOf(values.length)), expected);
}
-
- @Test
- public void testIntPointFieldRangeQuery() throws Exception {
- doTestIntPointFieldRangeQuery("number_p_i", "int", false);
- }
-
+
private void doTestIntPointFieldRangeQuery(String fieldName, String type, boolean testLong) throws Exception {
for (int i = 0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), fieldName, String.valueOf(i)));
@@ -199,11 +854,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//*[@numFound='" + (Math.max(0, i-1)) + "']");
}
}
-
- @Test
- public void testIntPointFieldSort() throws Exception {
- testPointFieldSort("number_p_i", "number_p_i_dv", new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"});
- }
private void testPointFieldFacetField(String nonDocValuesField, String docValuesField, String[] numbers) throws Exception {
assert numbers != null && numbers.length == 10;
@@ -222,6 +872,12 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + docValuesField +"']/int[@name='" + numbers[2] + "'][.='1']",
"//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + docValuesField +"']/int[@name='" + numbers[3] + "'][.='1']");
+ assertQ(req("q", "*:*", "fl", "id, " + docValuesField, "facet", "true", "facet.field", docValuesField, "facet.method", "enum"),
+ "//*[@numFound='10']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + docValuesField +"']/int[@name='" + numbers[1] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + docValuesField +"']/int[@name='" + numbers[2] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + docValuesField +"']/int[@name='" + numbers[3] + "'][.='1']");
+
assertU(adoc("id", "10", docValuesField, numbers[1], nonDocValuesField, numbers[1]));
assertU(commit());
@@ -239,16 +895,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
SolrException.ErrorCode.BAD_REQUEST);
}
- @Test
- public void testIntPointFieldFacetField() throws Exception {
- testPointFieldFacetField("number_p_i", "number_p_i_dv", getSequentialStringArrayWithInts(10));
- }
-
- @Test
- public void testIntPointFieldRangeFacet() throws Exception {
- doTestIntPointFieldRangeFacet("number_p_i_dv", "number_p_i");
- }
-
private void doTestIntPointFieldRangeFacet(String docValuesField, String nonDocValuesField) throws Exception {
for (int i = 0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), docValuesField, String.valueOf(i), nonDocValuesField, String.valueOf(i)));
@@ -297,11 +943,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
}
- @Test
- public void testIntPointFunctionQuery() throws Exception {
- doTestIntPointFunctionQuery("number_p_i_dv", "number_p_i", "int");
- }
-
private void doTestIntPointFunctionQuery(String dvFieldName, String nonDvFieldName, String type) throws Exception {
for (int i = 0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), dvFieldName, String.valueOf(i), nonDvFieldName, String.valueOf(i)));
@@ -339,7 +980,11 @@ public class TestPointFields extends SolrTestCaseJ4 {
SolrException.ErrorCode.BAD_REQUEST);
}
- private void testPointStats(String field, String dvField, String[] numbers, String min, String max, String count, String missing) {
+ private void testPointStats(String field, String dvField, String[] numbers, double min, double max, String count, String missing, double delta) {
+ String minMin = String.valueOf(min - Math.abs(delta*min));
+ String maxMin = String.valueOf(min + Math.abs(delta*min));
+ String minMax = String.valueOf(max - Math.abs(delta*max));
+ String maxMax = String.valueOf(max + Math.abs(delta*max));
for (int i = 0; i < numbers.length; i++) {
assertU(adoc("id", String.valueOf(i), dvField, numbers[i], field, numbers[i]));
}
@@ -349,8 +994,10 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertTrue(h.getCore().getLatestSchema().getField(dvField).getType() instanceof PointField);
assertQ(req("q", "*:*", "fl", "id, " + dvField, "stats", "true", "stats.field", dvField),
"//*[@numFound='11']",
- "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='min'][.='" + min + "']",
- "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='max'][.='" + max + "']",
+ "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='min'][.>='" + minMin + "']",
+ "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='min'][.<='" + maxMin+ "']",
+ "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='max'][.>='" + minMax + "']",
+ "//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/double[@name='max'][.<='" + maxMax + "']",
"//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/long[@name='count'][.='" + count + "']",
"//lst[@name='stats']/lst[@name='stats_fields']/lst[@name='" + dvField+ "']/long[@name='missing'][.='" + missing + "']");
@@ -361,22 +1008,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
req("q", "*:*", "fl", "id, " + field, "stats", "true", "stats.field", field),
SolrException.ErrorCode.BAD_REQUEST);
}
-
- @Test
- public void testIntPointStats() throws Exception {
- testPointStats("number_p_i", "number_p_i_dv", new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"},
- "0.0", "9.0", "10", "1");
- }
-
- @Test
- public void testIntPointGrouping() throws Exception {
- // nocommit: Implement or remove
- }
-
- @Test
- public void testIntPointPivotFaceting() throws Exception {
- // nocommit: Implement or remove
- }
private void testPointFieldMultiValuedExactQuery(String fieldName, String[] numbers) throws Exception {
assert numbers != null && numbers.length == 20;
@@ -395,11 +1026,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertQ(req("q", fieldName + ":" + numbers[i].replace("-", "\\-") + " OR " + fieldName + ":" + numbers[(i+1)%10].replace("-", "\\-")), "//*[@numFound='2']");
}
}
-
- @Test
- public void testIntPointFieldMultiValuedExactQuery() throws Exception {
- testPointFieldMultiValuedExactQuery("number_p_i_mv", getSequentialStringArrayWithInts(20));
- }
private void testPointFieldMultiValuedReturn(String fieldName, String type, String[] numbers) throws Exception {
assert numbers != null && numbers.length == 20;
@@ -421,11 +1047,6 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertQ(req("q", "*:*", "fl", "id, " + fieldName), expected2);
}
- @Test
- public void testIntPointFieldMultiValuedReturn() throws Exception {
- testPointFieldMultiValuedReturn("number_p_i_mv", "int", getSequentialStringArrayWithInts(20));
- }
-
private void testPointFieldMultiValuedRangeQuery(String fieldName, String type, String[] numbers) throws Exception {
assert numbers != null && numbers.length == 20;
assertTrue(h.getCore().getLatestSchema().getField(fieldName).multiValued());
@@ -483,139 +1104,45 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//result/doc[1]/arr[@name='" + fieldName + "']/" + type + "[1][.='" + numbers[0] + "']",
"//result/doc[10]/arr[@name='" + fieldName + "']/" + type + "[1][.='" + numbers[9] + "']");
}
-
- @Test
- public void testIntPointFieldMultiValuedRangeQuery() throws Exception {
- testPointFieldMultiValuedRangeQuery("number_p_i_mv", "int", getSequentialStringArrayWithInts(20));
- }
-
- //TODO MV SORT?
-
- private void testPointFieldMultiValuedFacetField(String nonDocValuesField, String dvFieldName, String[] numbers) throws Exception {
- assert numbers != null && numbers.length == 20;
- assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).multiValued());
- assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).getType() instanceof PointField);
-
- for (int i = 0; i < 10; i++) {
- assertU(adoc("id", String.valueOf(i), dvFieldName, numbers[i], dvFieldName, numbers[i + 10],
- nonDocValuesField, numbers[i], nonDocValuesField, numbers[i + 10]));
- }
- assertU(commit());
-
- assertQ(req("q", "*:*", "fl", "id, " + dvFieldName, "facet", "true", "facet.field", dvFieldName),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[1] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[2] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[3] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[10] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[11] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[12] + "'][.='1']");
-
- assertU(adoc("id", "10", dvFieldName, numbers[1], nonDocValuesField, numbers[1]));
-
- assertU(commit());
- assertQ(req("q", "*:*", "fl", "id, " + dvFieldName, "facet", "true", "facet.field", dvFieldName),
- "//*[@numFound='11']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[1] + "'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[2] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[3] + "'][.='1']",
- "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[10] + "'][.='1']");
-
- assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof PointField);
- assertQEx("Expecting Exception",
- "Can't facet on a PointField without docValues",
- req("q", "*:*", "fl", "id, " + nonDocValuesField, "facet", "true", "facet.field", nonDocValuesField),
- SolrException.ErrorCode.BAD_REQUEST);
- }
-
-
- @Test
- @Ignore
- public void testIntPointFieldMultiValuedFacetField() throws Exception {
- testPointFieldMultiValuedFacetField("number_p_i_mv", "number_p_i_mv_dv", getSequentialStringArrayWithInts(20));
- }
-
- @Test
- @Ignore
- public void testIntPointFieldMultiValuedRangeFacet() throws Exception {
- String docValuesField = "number_p_i_mv_dv";
- String nonDocValuesField = "number_p_i_mv";
-
- for (int i = 0; i < 10; i++) {
- assertU(adoc("id", String.valueOf(i), docValuesField, String.valueOf(i), docValuesField, String.valueOf(i + 10),
- nonDocValuesField, String.valueOf(i), nonDocValuesField, String.valueOf(i + 10)));
- }
- assertU(commit());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof IntPointField);
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
-
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+ private void testPointFieldMultiValuedFacetField(String nonDocValuesField, String dvFieldName, String[] numbers) throws Exception {
+ assert numbers != null && numbers.length == 20;
+ assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).multiValued());
+ assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).getType() instanceof PointField);
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "0", "facet.range.end", "20", "facet.range.gap", "100"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0'][.='10']");
+ for (int i = 0; i < 10; i++) {
+ assertU(adoc("id", String.valueOf(i), dvFieldName, numbers[i], dvFieldName, numbers[i + 10],
+ nonDocValuesField, numbers[i], nonDocValuesField, numbers[i + 10]));
+ }
+ assertU(commit());
- assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof IntPointField);
- // Range Faceting with method = filter should work
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "filter"),
+ assertQ(req("q", "*:*", "fl", "id, " + dvFieldName, "facet", "true", "facet.field", dvFieldName),
"//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[1] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[2] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[3] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[10] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[11] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[12] + "'][.='1']");
- // this should actually use filter method instead of dv
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10'][.='0']");
+ assertU(adoc("id", "10", dvFieldName, numbers[1], nonDocValuesField, numbers[1]));
+
+ assertU(commit());
+ assertQ(req("q", "*:*", "fl", "id, " + dvFieldName, "facet", "true", "facet.field", dvFieldName),
+ "//*[@numFound='11']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[1] + "'][.='2']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[2] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[3] + "'][.='1']",
+ "//lst[@name='facet_counts']/lst[@name='facet_fields']/lst[@name='" + dvFieldName +"']/int[@name='" + numbers[10] + "'][.='1']");
+
+ assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof PointField);
+ assertQEx("Expecting Exception",
+ "Can't facet on a PointField without docValues",
+ req("q", "*:*", "fl", "id, " + nonDocValuesField, "facet", "true", "facet.field", nonDocValuesField),
+ SolrException.ErrorCode.BAD_REQUEST);
}
-
private void testPointMultiValuedFunctionQuery(String nonDocValuesField, String docValuesField, String type, String[] numbers) throws Exception {
assert numbers != null && numbers.length == 20;
@@ -668,35 +1195,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
req("q", "*:*", "fl", "id, " + function),
SolrException.ErrorCode.BAD_REQUEST);
}
-
-
-// private boolean dvIsRandomAccessOrds(String field) throws IOException {
-// RefCounted<SolrIndexSearcher> ref = null;
-// try {
-// ref = h.getCore().getSearcher();
-// SortedSetDocValues values = DocValues.getSortedSet(ref.get().getIndexReader().leaves().get(0).reader(), field);
-// return values instanceof RandomAccessOrds;
-// } finally {
-// if (ref != null) ref.decref();
-// }
-// }
-
- @Test
- @Ignore
- public void testIntPointMultiValuedFunctionQuery() throws Exception {
- testPointMultiValuedFunctionQuery("number_p_i_mv", "number_p_i_mv_dv", "int", getSequentialStringArrayWithInts(20));
- }
-
- @Test
- public void testIntPointFieldsAtomicUpdates() throws Exception {
- if (!Boolean.getBoolean("enable.update.log")) {
- return;
- }
- testIntPointFieldsAtomicUpdates("number_p_i", "int");
- testIntPointFieldsAtomicUpdates("number_p_i_dv", "int");
- testIntPointFieldsAtomicUpdates("number_p_i_dv_ns", "int");
- }
-
+
private void testIntPointFieldsAtomicUpdates(String field, String type) throws Exception {
assertU(adoc(sdoc("id", "1", field, "1")));
assertU(commit());
@@ -719,17 +1218,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertQ(req("q", "id:1"),
"//result/doc[1]/" + type + "[@name='" + field + "'][.='3']");
}
-
- @Test
- public void testDoublePointFieldExactQuery() throws Exception {
- doTestFloatPointFieldExactQuery("number_d");
- doTestFloatPointFieldExactQuery("number_p_d");
- doTestFloatPointFieldExactQuery("number_p_d_mv");
- doTestFloatPointFieldExactQuery("number_p_d_ni_dv");
-// doTestFloatPointFieldExactQuery("number_p_d_ni_mv_dv");
- }
-
private void doTestFloatPointFieldExactQuery(String field) throws Exception {
for (int i=0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), field, String.valueOf(i + "." + i)));
@@ -759,229 +1248,114 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertU(commit());
}
- @Test
- public void testDoublePointFieldReturn() throws Exception {
- testPointFieldReturn("number_p_d", "double", new String[]{"0.0", "1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
- clearIndex();
- assertU(commit());
- testPointFieldReturn("number_p_d_dv_ns", "double", new String[]{"0.0", "1.2", "2.5", "3.02", "0.43", "5.2", "6.01", "74.0", "80.0", "9.9"});
- clearIndex();
- assertU(commit());
- String[] arr = new String[atLeast(10)];
+ private void doTestPointFieldSort(String field, String dvField, String[] arr) throws Exception {
+ assert arr != null && arr.length == 10;
for (int i = 0; i < arr.length; i++) {
- double rand = random().nextDouble() * 10;
- arr[i] = String.valueOf(rand);
+ assertU(adoc("id", String.valueOf(i), dvField, String.valueOf(arr[i]), field, String.valueOf(arr[i])));
}
- testPointFieldReturn("number_p_d", "double", arr);
+ assertU(commit());
+ assertTrue(h.getCore().getLatestSchema().getField(dvField).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(dvField).getType() instanceof PointField);
+ assertQ(req("q", "*:*", "fl", "id", "sort", dvField + " desc"),
+ "//*[@numFound='10']",
+ "//result/doc[1]/str[@name='id'][.='9']",
+ "//result/doc[2]/str[@name='id'][.='8']",
+ "//result/doc[3]/str[@name='id'][.='7']",
+ "//result/doc[10]/str[@name='id'][.='0']");
+
+ assertFalse(h.getCore().getLatestSchema().getField(field).hasDocValues());
+ assertTrue(h.getCore().getLatestSchema().getField(field).getType() instanceof PointField);
+ assertQEx("Expecting Exception",
+ "can not sort on a PointField without doc values: " + field,
+ req("q", "*:*", "fl", "id", "sort", field + " desc"),
+ SolrException.ErrorCode.BAD_REQUEST);
+
+ //TODO: sort missing
}
- @Test
- public void testDoublePointFieldRangeQuery() throws Exception {
- String fieldName = "number_p_d";
+ private void doTestFloatPointFieldRangeQuery(String fieldName, String type, boolean testDouble) throws Exception {
for (int i = 0; i < 10; i++) {
assertU(adoc("id", String.valueOf(i), fieldName, String.valueOf(i)));
}
assertU(commit());
assertQ(req("q", fieldName + ":[0 TO 3]", "fl", "id, " + fieldName),
"//*[@numFound='4']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='0.0']",
- "//result/doc[2]/double[@name='" + fieldName + "'][.='1.0']",
- "//result/doc[3]/double[@name='" + fieldName + "'][.='2.0']",
- "//result/doc[4]/double[@name='" + fieldName + "'][.='3.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='0.0']",
+ "//result/doc[2]/" + type + "[@name='" + fieldName + "'][.='1.0']",
+ "//result/doc[3]/" + type + "[@name='" + fieldName + "'][.='2.0']",
+ "//result/doc[4]/" + type + "[@name='" + fieldName + "'][.='3.0']");
assertQ(req("q", fieldName + ":{0 TO 3]", "fl", "id, " + fieldName),
"//*[@numFound='3']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='1.0']",
- "//result/doc[2]/double[@name='" + fieldName + "'][.='2.0']",
- "//result/doc[3]/double[@name='" + fieldName + "'][.='3.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='1.0']",
+ "//result/doc[2]/" + type + "[@name='" + fieldName + "'][.='2.0']",
+ "//result/doc[3]/" + type + "[@name='" + fieldName + "'][.='3.0']");
assertQ(req("q", fieldName + ":[0 TO 3}", "fl", "id, " + fieldName),
"//*[@numFound='3']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='0.0']",
- "//result/doc[2]/double[@name='" + fieldName + "'][.='1.0']",
- "//result/doc[3]/double[@name='" + fieldName + "'][.='2.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='0.0']",
+ "//result/doc[2]/" + type + "[@name='" + fieldName + "'][.='1.0']",
+ "//result/doc[3]/" + type + "[@name='" + fieldName + "'][.='2.0']");
assertQ(req("q", fieldName + ":{0 TO 3}", "fl", "id, " + fieldName),
"//*[@numFound='2']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='1.0']",
- "//result/doc[2]/double[@name='" + fieldName + "'][.='2.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='1.0']",
+ "//result/doc[2]/" + type + "[@name='" + fieldName + "'][.='2.0']");
assertQ(req("q", fieldName + ":{0 TO *}", "fl", "id, " + fieldName),
"//*[@numFound='9']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='1.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='1.0']");
assertQ(req("q", fieldName + ":{* TO 3}", "fl", "id, " + fieldName),
"//*[@numFound='3']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='0.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='0.0']");
assertQ(req("q", fieldName + ":[* TO 3}", "fl", "id, " + fieldName),
"//*[@numFound='3']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='0.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='0.0']");
assertQ(req("q", fieldName + ":[* TO *}", "fl", "id, " + fieldName),
"//*[@numFound='10']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='0.0']",
- "//result/doc[10]/double[@name='" + fieldName + "'][.='9.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='0.0']",
+ "//result/doc[10]/" + type + "[@name='" + fieldName + "'][.='9.0']");
assertQ(req("q", fieldName + ":[0.9 TO 1.01]", "fl", "id, " + fieldName),
"//*[@numFound='1']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='1.0']");
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='1.0']");
assertQ(req("q", fieldName + ":{0.9 TO 1.01}", "fl", "id, " + fieldName),
"//*[@numFound='1']",
- "//result/doc[1]/double[@name='" + fieldName + "'][.='1.0']");
-
- clearIndex();
- assertU(commit());
-
- String[] arr = getRandomStringArrayWithFloats(10, true);
- for (int i = 0; i < arr.length; i++) {
- assertU(adoc("id", String.valueOf(i), fieldName, arr[i]));
- }
- assertU(commit());
- for (int i = 0; i < arr.length; i++) {
- assertQ(req("q", fieldName + ":[" + arr[0] + " TO " + arr[i] + "]", "fl", "id, " + fieldName),
- "//*[@numFound='" + (i + 1) + "']");
- assertQ(req("q", fieldName + ":{" + arr[0] + " TO " + arr[i] + "}", "fl", "id, " + fieldName),
- "//*[@numFound='" + (Math.max(0, i-1)) + "']");
- }
- }
-
- @Test
- public void testDoublePointFieldSort() throws Exception {
- String[] arr = getRandomStringArrayWithFloats(10, true);
- testPointFieldSort("number_p_d", "number_p_d_dv", arr);
- }
-
- private void testPointFieldSort(String field, String dvField, String[] arr) throws Exception {
- assert arr != null && arr.length == 10;
- for (int i = 0; i < arr.length; i++) {
- assertU(adoc("id", String.valueOf(i), dvField, String.valueOf(arr[i]), field, String.valueOf(arr[i])));
- }
- assertU(commit());
- assertTrue(h.getCore().getLatestSchema().getField(dvField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(dvField).getType() instanceof PointField);
- assertQ(req("q", "*:*", "fl", "id", "sort", dvField + " desc"),
- "//*[@numFound='10']",
- "//result/doc[1]/str[@name='id'][.='9']",
- "//result/doc[2]/str[@name='id'][.='8']",
- "//result/doc[3]/str[@name='id'][.='7']",
- "//result/doc[10]/str[@name='id'][.='0']");
-
- assertFalse(h.getCore().getLatestSchema().getField(field).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(field).getType() instanceof PointField);
- assertQEx("Expecting Exception",
- "can not sort on a PointField without doc values: " + field,
- req("q", "*:*", "fl", "id", "sort", field + " desc"),
- SolrException.ErrorCode.BAD_REQUEST);
+ "//result/doc[1]/" + type + "[@name='" + fieldName + "'][.='1.0']");
- //TODO: sort missing
- }
-
- @Test
- public void testDoublePointFieldFacetField() throws Exception {
- testPointFieldFacetField("number_p_d", "number_p_d_dv", getSequentialStringArrayWithDoubles(10));
- clearIndex();
- assertU(commit());
- testPointFieldFacetField("number_p_d", "number_p_d_dv", getRandomStringArrayWithFloats(10, false));
- }
-
- private String[] getRandomStringArrayWithFloats(int length, boolean sorted) {
- Set<Float> set;
- if (sorted) {
- set = new TreeSet<>();
- } else {
- set = new HashSet<>();
- }
- while (set.size() < length) {
- float f = random().nextFloat() * 100;
- if (random().nextBoolean()) {
- f = f * -1;
- }
- set.add(f);
- }
- String[] stringArr = new String[length];
- int i = 0;
- for (float val:set) {
- stringArr[i] = String.valueOf(val);
- i++;
- }
- return stringArr;
- }
-
- private String[] getSequentialStringArrayWithInts(int length) {
- String[] arr = new String[length];
- for (int i = 0; i < length; i++) {
- arr[i] = String.valueOf(i);
- }
- return arr;
- }
-
- private String[] getSequentialStringArrayWithDoubles(int length) {
- String[] arr = new String[length];
- for (int i = 0; i < length; i++) {
- arr[i] = String.format(Locale.ROOT, "%d.0", i);
- }
- return arr;
- }
-
- private String[] getRandomStringArrayWithInts(int length, boolean sorted) {
- Set<Integer> set;
- if (sorted) {
- set = new TreeSet<>();
- } else {
- set = new HashSet<>();
- }
- while (set.size() < length) {
- int number = random().nextInt(100);
- if (random().nextBoolean()) {
- number = number * -1;
- }
- set.add(number);
- }
- String[] stringArr = new String[length];
- int i = 0;
- for (int val:set) {
- stringArr[i] = String.valueOf(val);
- i++;
- }
- return stringArr;
- }
-
- private String[] getRandomStringArrayWithLongs(int length, boolean sorted) {
- Set<Long> set;
- if (sorted) {
- set = new TreeSet<>();
+ clearIndex();
+ assertU(commit());
+
+ String[] arr;
+ if (testDouble) {
+ arr = getRandomStringArrayWithDoubles(10, true);
} else {
- set = new HashSet<>();
+ arr = getRandomStringArrayWithFloats(10, true);
}
- while (set.size() < length) {
- long number = random().nextLong();
- if (random().nextBoolean()) {
- number = number * -1;
- }
- set.add(number);
+ for (int i = 0; i < arr.length; i++) {
+ assertU(adoc("id", String.valueOf(i), fieldName, arr[i]));
}
- String[] stringArr = new String[length];
- int i = 0;
- for (long val:set) {
- stringArr[i] = String.valueOf(val);
- i++;
+ assertU(commit());
+ for (int i = 0; i < arr.length; i++) {
+ assertQ(req("q", fieldName + ":[" + arr[0] + " TO " + arr[i] + "]", "fl", "id, " + fieldName),
+ "//*[@numFound='" + (i + 1) + "']");
+ assertQ(req("q", fieldName + ":{" + arr[0] + " TO " + arr[i] + "}", "fl", "id, " + fieldName),
+ "//*[@numFound='" + (Math.max(0, i-1)) + "']");
}
- return stringArr;
}
-
- @Test
- public void testDoublePointFieldRangeFacet() throws Exception {
- String docValuesField = "number_p_d_dv";
- String nonDocValuesField = "number_p_d";
+
+ private void doTestFloatPointFieldRangeFacet(String docValuesField, String nonDocValuesField) throws Exception {
for (int i = 0; i < 10; i++) {
- assertU(adoc("id", String.valueOf(i), docValuesField, String.format(Locale.ROOT, "%f", (double)i*1.1), nonDocValuesField, String.format(Locale.ROOT, "%f", (double)i*1.1)));
+ assertU(adoc("id", String.valueOf(i), docValuesField, String.format(Locale.ROOT, "%f", (float)i*1.1), nonDocValuesField, String.format(Locale.ROOT, "%f", (float)i*1.1)));
}
assertU(commit());
assertTrue(h.getCore().getLatestSchema().getField(docValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof DoublePointField);
+ assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof PointField);
assertQ(req("q", "*:*", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "10", "facet.range.gap", "2"),
"//*[@numFound='10']",
"//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
@@ -1001,7 +1375,7 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof DoublePointField);
+ assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof PointField);
// Range Faceting with method = filter should work
assertQ(req("q", "*:*", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "10", "facet.range.gap", "2", "facet.range.method", "filter"),
"//*[@numFound='10']",
@@ -1022,24 +1396,20 @@ public class TestPointFields extends SolrTestCaseJ4 {
"//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
"//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
}
-
-
- @Test
- public void testDoublePointFunctionQuery() throws Exception {
- String dvFieldName = "number_p_d_dv";
- String nonDvFieldName = "number_p_d";
+
+ private void doTestFloatPointFunctionQuery(String dvFieldName, String nonDvFieldName, String type) throws Exception {
for (int i = 0; i < 10; i++) {
- assertU(adoc("id", String.valueOf(i), dvFieldName, String.format(Locale.ROOT, "%f", (double)i*1.1), nonDvFieldName, String.format(Locale.ROOT, "%f", (double)i*1.1)));
+ assertU(adoc("id", String.valueOf(i), dvFieldName, String.format(Locale.ROOT, "%f", (float)i*1.1), nonDvFieldName, String.format(Locale.ROOT, "%f", (float)i*1.1)));
}
assertU(commit());
assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).getType() instanceof DoublePointField);
+ assertTrue(h.getCore().getLatestSchema().getField(dvFieldName).getType() instanceof PointField);
assertQ(req("q", "*:*", "fl", "id, " + dvFieldName, "sort", "product(-1," + dvFieldName + ") asc"),
"//*[@numFound='10']",
- "//result/doc[1]/double[@name='" + dvFieldName + "'][.='9.9']",
- "//result/doc[2]/double[@name='" + dvFieldName + "'][.='8.8']",
- "//result/doc[3]/double[@name='" + dvFieldName + "'][.='7.7']",
- "//result/doc[10]/double[@name='" + dvFieldName + "'][.='0.0']");
+ "//result/doc[1]/" + type + "[@name='" + dvFieldName + "'][.='9.9']",
+ "//result/doc[2]/" + type + "[@name='" + dvFieldName + "'][.='8.8']",
+ "//result/doc[3]/" + type + "[@name='" + dvFieldName + "'][.='7.7']",
+ "//result/doc[10]/" + type + "[@name='" + dvFieldName + "'][.='0.0']");
assertQ(req("q", "*:*", "fl", "id, " + dvFieldName + ", product(-1," + dvFieldName + ")"),
"//*[@numFound='10']",
@@ -1050,253 +1420,17 @@ public class TestPointFields extends SolrTestCaseJ4 {
assertQ(req("q", "*:*", "fl", "id, " + dvFieldName + ", field(" + dvFieldName + ")"),
"//*[@numFound='10']",
- "//result/doc[1]/double[@name='field(" + dvFieldName + ")'][.='0.0']",
- "//result/doc[2]/double[@name='field(" + dvFieldName + ")'][.='1.1']",
- "//result/doc[3]/double[@name='field(" + dvFieldName + ")'][.='2.2']",
- "//result/doc[10]/double[@name='field(" + dvFieldName + ")'][.='9.9']");
+ "//result/doc[1]/" + type + "[@name='field(" + dvFieldName + ")'][.='0.0']",
+ "//result/doc[2]/" + type + "[@name='field(" + dvFieldName + ")'][.='1.1']",
+ "//result/doc[3]/" + type + "[@name='field(" + dvFieldName + ")'][.='2.2']",
+ "//result/doc[10]/" + type + "[@name='field(" + dvFieldName + ")'][.='9.9']");
assertFalse(h.getCore().getLatestSchema().getField(nonDvFieldName).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(nonDvFieldName).getType() instanceof DoublePointField);
+ assertTrue(h.getCore().getLatestSchema().getField(nonDvFieldName).getType() instanceof PointField);
assertQEx("Expecting Exception",
"sort param could not be parsed as a query",
req("q", "*:*", "fl", "id, " + nonDvFieldName, "sort", "product(-1," + nonDvFieldName + ") asc"),
SolrException.ErrorCode.BAD_REQUEST);
}
-
- @Test
- public void testDoublePointStats() throws Exception {
- testPointStats("number_p_d", "number_p_d_dv", new String[]{"-10.0", "1.1", "2.2", "3.3", "4.4", "5.5", "6.6", "7.7", "8.8", "9.9"},
- "-10.0", "9.9", "10", "1");
- }
-
- @Test
- public void testDoublePointFieldMultiValuedExactQuery() throws Exception {
- testPointFieldMultiValuedExactQuery("number_p_d_mv", getRandomStringArrayWithFloats(20, false));
- }
-
- @Test
- public void testDoublePointFieldMultiValuedReturn() throws Exception {
- testPointFieldMultiValuedReturn("number_p_d_mv", "double", getSequentialStringArrayWithDoubles(20));
- }
-
- @Test
- public void testDoublePointFieldMultiValuedRangeQuery() throws Exception {
- testPointFieldMultiValuedRangeQuery("number_p_d_mv", "double", getSequentialStringArrayWithDoubles(20));
- }
-
- @Test
- @Ignore
- public void testDoublePointFieldMultiValuedFacetField() throws Exception {
- testPointFieldMultiValuedFacetField("number_p_d_mv", "number_p_d_mv_dv", getSequentialStringArrayWithDoubles(20));
- testPointFieldMultiValuedFacetField("number_p_d_mv", "number_p_d_mv_dv", getRandomStringArrayWithFloats(20, false));
- }
-
-
- @Test
- @Ignore
- public void testDoublePointFieldMultiValuedRangeFacet() throws Exception {
- String docValuesField = "number_p_d_mv_dv";
- String nonDocValuesField = "number_p_d_mv";
-
- for (int i = 0; i < 10; i++) {
- assertU(adoc("id", String.valueOf(i), docValuesField, String.valueOf(i), docValuesField, String.valueOf(i + 10),
- nonDocValuesField, String.valueOf(i), nonDocValuesField, String.valueOf(i + 10)));
- }
- assertU(commit());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).multiValued());
- assertTrue(h.getCore().getLatestSchema().getField(docValuesField).getType() instanceof DoublePointField);
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
-
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
-
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", docValuesField, "facet.range.start", "0", "facet.range.end", "20", "facet.range.gap", "100"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + docValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='10']");
-
- assertFalse(h.getCore().getLatestSchema().getField(nonDocValuesField).hasDocValues());
- assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).multiValued());
- assertTrue(h.getCore().getLatestSchema().getField(nonDocValuesField).getType() instanceof DoublePointField);
- // Range Faceting with method = filter should work
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "filter"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='12.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='14.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='16.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='18.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='-10.0'][.='0']");
-
- // this should actually use filter method instead of dv
- assertQ(req("q", "*:*", "fl", "id", "facet", "true", "facet.range", nonDocValuesField, "facet.range.start", "-10", "facet.range.end", "20", "facet.range.gap", "2", "facet.range.method", "dv"),
- "//*[@numFound='10']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='0.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='2.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='4.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='6.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='8.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/int[@name='10.0'][.='2']",
- "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='" + nonDocValuesField + "']/lst[@name='counts']/in
<TRUNCATED>
[3/3] lucene-solr:jira/solr-8396: Added FloatPointField.
Posted by tf...@apache.org.
Added FloatPointField.
Most test pass, but "enum" facet doesn't work. Modified TestPointFields to isolate the failure, but still didn't investigate the cause.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f4c68cdd
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f4c68cdd
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f4c68cdd
Branch: refs/heads/jira/solr-8396
Commit: f4c68cddb2005f6ccb100524dc715d0e25917547
Parents: 5fa22ce
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Sun Oct 16 22:41:48 2016 -0700
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Sun Oct 16 22:41:48 2016 -0700
----------------------------------------------------------------------
.../org/apache/solr/response/DocsStreamer.java | 4 +-
.../org/apache/solr/schema/FloatPointField.java | 179 +++
.../DocumentExpressionDictionaryFactory.java | 12 +-
.../solr/collection1/conf/schema-point.xml | 26 +-
.../test-files/solr/collection1/conf/schema.xml | 9 +-
.../solr/collection1/conf/schema11.xml | 12 +-
.../solr/collection1/conf/schema12.xml | 7 +-
.../solr/collection1/conf/schema_latest.xml | 7 +-
.../test/org/apache/solr/TestPointFields.java | 1452 ++++++++++--------
.../handler/admin/LukeRequestHandlerTest.java | 2 +
.../java/org/apache/solr/SolrTestCaseJ4.java | 6 +-
11 files changed, 1026 insertions(+), 690 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/java/org/apache/solr/response/DocsStreamer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/DocsStreamer.java b/solr/core/src/java/org/apache/solr/response/DocsStreamer.java
index bee09fc..ef0b0c7 100644
--- a/solr/core/src/java/org/apache/solr/response/DocsStreamer.java
+++ b/solr/core/src/java/org/apache/solr/response/DocsStreamer.java
@@ -33,6 +33,7 @@ import org.apache.solr.schema.BinaryField;
import org.apache.solr.schema.BoolField;
import org.apache.solr.schema.DoublePointField;
import org.apache.solr.schema.FieldType;
+import org.apache.solr.schema.FloatPointField;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.IntPointField;
import org.apache.solr.schema.LongPointField;
@@ -217,8 +218,9 @@ public class DocsStreamer implements Iterator<SolrDocument> {
KNOWN_TYPES.add(TrieDateField.class);
KNOWN_TYPES.add(BinaryField.class);
KNOWN_TYPES.add(IntPointField.class);
- KNOWN_TYPES.add(DoublePointField.class);
KNOWN_TYPES.add(LongPointField.class);
+ KNOWN_TYPES.add(DoublePointField.class);
+ KNOWN_TYPES.add(FloatPointField.class);
// We do not add UUIDField because UUID object is not a supported type in JavaBinCodec
// and if we write UUIDField.toObject, we wouldn't know how to handle it in the client side
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/java/org/apache/solr/schema/FloatPointField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/FloatPointField.java b/solr/core/src/java/org/apache/solr/schema/FloatPointField.java
new file mode 100644
index 0000000..2098e37
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/schema/FloatPointField.java
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ */
+
+package org.apache.solr.schema;
+
+import java.lang.invoke.MethodHandles;
+
+import org.apache.lucene.document.FloatPoint;
+import org.apache.lucene.document.StoredField;
+import org.apache.lucene.index.DocValuesType;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.legacy.LegacyNumericType;
+import org.apache.lucene.queries.function.ValueSource;
+import org.apache.lucene.queries.function.valuesource.FloatFieldSource;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.SortField;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.BytesRefBuilder;
+import org.apache.solr.search.QParser;
+import org.apache.solr.uninverting.UninvertingReader.Type;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FloatPointField extends PointField implements FloatValueFieldType {
+
+ private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ public FloatPointField() {
+ super(Float.BYTES);
+ }
+
+ {
+ type = PointTypes.FLOAT;
+ }
+
+ @Override
+ public Object toNativeType(Object val) {
+ if (val == null) return null;
+ if (val instanceof Number) return ((Number) val).floatValue();
+ if (val instanceof String) return Float.parseFloat((String) val);
+ return super.toNativeType(val);
+ }
+
+ public Query getRangeQuery(QParser parser, SchemaField field, String min, String max, boolean minInclusive,
+ boolean maxInclusive) {
+ float actualMin, actualMax;
+ if (min == null) {
+ actualMin = Float.NEGATIVE_INFINITY;
+ } else {
+ actualMin = Float.parseFloat(min);
+ if (!minInclusive) {
+ actualMin = Math.nextUp(actualMin);
+ }
+ }
+ if (max == null) {
+ actualMax = Float.POSITIVE_INFINITY;
+ } else {
+ actualMax = Float.parseFloat(max);
+ if (!maxInclusive) {
+ actualMax = Math.nextDown(actualMax);
+ }
+ }
+ return FloatPoint.newRangeQuery(field.getName(), actualMin, actualMax);
+ }
+
+ @Override
+ public Object toObject(SchemaField sf, BytesRef term) {
+ return FloatPoint.decodeDimension(term.bytes, term.offset);
+ }
+
+ @Override
+ public Object toObject(IndexableField f) {
+ final Number val = f.numericValue();
+ if (val != null) {
+ if (f.fieldType().stored() == false && f.fieldType().docValuesType() == DocValuesType.NUMERIC) {
+ return Float.intBitsToFloat(val.intValue());
+ } else {
+ return val;
+ }
+ } else {
+ throw new AssertionError("Unexpected state. Field: '" + f + "'");
+ }
+ }
+
+ @Override
+ protected Query getExactQuery(QParser parser, SchemaField field, String externalVal) {
+ return FloatPoint.newExactQuery(field.getName(), Float.parseFloat(externalVal));
+ }
+
+ @Override
+ protected String indexedToReadable(BytesRef indexedForm) {
+ return Float.toString(FloatPoint.decodeDimension(indexedForm.bytes, indexedForm.offset));
+ }
+
+ @Override
+ public void readableToIndexed(CharSequence val, BytesRefBuilder result) {
+ result.grow(Float.BYTES);
+ result.setLength(Float.BYTES);
+ FloatPoint.encodeDimension(Float.parseFloat(val.toString()), result.bytes(), 0);
+ }
+
+ @Override
+ protected BytesRef storedToIndexedByteRef(IndexableField f) {
+ BytesRef bytes = new BytesRef(new byte[Float.BYTES], 0, Float.BYTES);
+ FloatPoint.encodeDimension(f.numericValue().floatValue(), bytes.bytes, 0);
+ return bytes;
+ }
+
+
+ @Override
+ public SortField getSortField(SchemaField field, boolean top) {
+ field.checkSortability();
+
+ Object missingValue = null;
+ boolean sortMissingLast = field.sortMissingLast();
+ boolean sortMissingFirst = field.sortMissingFirst();
+
+ if (sortMissingLast) {
+ missingValue = top ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
+ } else if (sortMissingFirst) {
+ missingValue = top ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
+ }
+ SortField sf = new SortField(field.getName(), SortField.Type.FLOAT, top);
+ sf.setMissingValue(missingValue);
+ return sf;
+ }
+
+ @Override
+ public Type getUninversionType(SchemaField sf) {
+ if (sf.multiValued()) {
+ throw new UnsupportedOperationException("MultiValued Point fields with DocValues is not currently supported");
+// return Type.SORTED_FLOAT;
+ } else {
+ return Type.FLOAT_POINT;
+ }
+ }
+
+ @Override
+ public ValueSource getValueSource(SchemaField field, QParser qparser) {
+ field.checkFieldCacheSource();
+ return new FloatFieldSource(field.getName());
+ }
+
+ @Override
+ public LegacyNumericType getNumericType() {
+ // TODO: refactor this to not use LegacyNumericType
+ return LegacyNumericType.FLOAT;
+ }
+
+ @Override
+ public IndexableField createField(SchemaField field, Object value, float boost) {
+ if (!isFieldUsed(field)) return null;
+
+ if (boost != 1.0 && log.isTraceEnabled()) {
+ log.trace("Can't use document/field boost for PointField. Field: " + field.getName() + ", boost: " + boost);
+ }
+ float floatValue = (value instanceof Number) ? ((Number) value).floatValue() : Float.parseFloat(value.toString());
+ return new FloatPoint(field.getName(), floatValue);
+ }
+
+ @Override
+ protected StoredField getStoredField(SchemaField sf, Object value) {
+ return new StoredField(sf.getName(), (Float) this.toNativeType(value));
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
index 24f1553..77f9105 100644
--- a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
+++ b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java
@@ -28,7 +28,11 @@ import org.apache.lucene.search.SortField;
import org.apache.lucene.search.spell.Dictionary;
import org.apache.lucene.search.suggest.DocumentValueSourceDictionary;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.schema.DoublePointField;
import org.apache.solr.schema.FieldType;
+import org.apache.solr.schema.FloatPointField;
+import org.apache.solr.schema.IntPointField;
+import org.apache.solr.schema.LongPointField;
import org.apache.solr.schema.TrieDoubleField;
import org.apache.solr.schema.TrieFloatField;
import org.apache.solr.schema.TrieIntField;
@@ -111,13 +115,13 @@ public class DocumentExpressionDictionaryFactory extends DictionaryFactory {
SortField.Type type = null;
String fieldTypeName = core.getLatestSchema().getField(sortFieldName).getType().getTypeName();
FieldType ft = core.getLatestSchema().getFieldTypes().get(fieldTypeName);
- if (ft instanceof TrieFloatField) {
+ if (ft instanceof TrieFloatField || ft instanceof FloatPointField) {
type = SortField.Type.FLOAT;
- } else if (ft instanceof TrieIntField) {
+ } else if (ft instanceof TrieIntField || ft instanceof IntPointField) {
type = SortField.Type.INT;
- } else if (ft instanceof TrieLongField) {
+ } else if (ft instanceof TrieLongField || ft instanceof LongPointField) {
type = SortField.Type.LONG;
- } else if (ft instanceof TrieDoubleField) {
+ } else if (ft instanceof TrieDoubleField || ft instanceof DoublePointField) {
type = SortField.Type.DOUBLE;
}
return type;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test-files/solr/collection1/conf/schema-point.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-point.xml b/solr/core/src/test-files/solr/collection1/conf/schema-point.xml
index 48c1059..08c0d96 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-point.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-point.xml
@@ -57,8 +57,10 @@
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="pint" class="solr.IntPointField"/>
- <fieldType name="pdouble" class="solr.DoublePointField"/>
<fieldType name="plong" class="solr.LongPointField"/>
+ <fieldType name="pdouble" class="solr.DoublePointField"/>
+ <fieldType name="pfloat" class="solr.FloatPointField"/>
+
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
@@ -101,6 +103,13 @@
<dynamicField name="*_p_i_ni_dv" type="pint" indexed="false" stored="true" docValues="true"/>
<dynamicField name="*_p_i_ni_mv_dv" type="pint" indexed="false" stored="true" docValues="true" multiValued="true"/>
+ <dynamicField name="*_p_l" type="plong" indexed="true" stored="true"/>
+ <dynamicField name="*_p_l_dv" type="plong" indexed="true" stored="true" docValues="true"/>
+ <dynamicField name="*_p_l_mv" type="plong" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_p_l_mv_dv" type="plong" indexed="true" stored="true" docValues="true" multiValued="true"/>
+ <dynamicField name="*_p_l_ni_dv" type="plong" indexed="false" stored="true" docValues="true"/>
+ <dynamicField name="*_p_l_ni_mv_dv" type="plong" indexed="false" stored="true" docValues="true" multiValued="true"/>
+
<dynamicField name="*_p_d" type="pdouble" indexed="true" stored="true"/>
<dynamicField name="*_p_d_dv" type="pdouble" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_p_d_mv" type="pdouble" indexed="true" stored="true" multiValued="true"/>
@@ -108,17 +117,18 @@
<dynamicField name="*_p_d_ni_dv" type="pdouble" indexed="false" stored="true" docValues="true"/>
<dynamicField name="*_p_d_ni_mv_dv" type="pdouble" indexed="false" stored="true" docValues="true" multiValued="true"/>
- <dynamicField name="*_p_l" type="plong" indexed="true" stored="true"/>
- <dynamicField name="*_p_l_dv" type="plong" indexed="true" stored="true" docValues="true"/>
- <dynamicField name="*_p_l_mv" type="plong" indexed="true" stored="true" multiValued="true"/>
- <dynamicField name="*_p_l_mv_dv" type="plong" indexed="true" stored="true" docValues="true" multiValued="true"/>
- <dynamicField name="*_p_l_ni_dv" type="plong" indexed="false" stored="true" docValues="true"/>
- <dynamicField name="*_p_l_ni_mv_dv" type="plong" indexed="false" stored="true" docValues="true" multiValued="true"/>
+ <dynamicField name="*_p_f" type="pfloat" indexed="true" stored="true"/>
+ <dynamicField name="*_p_f_dv" type="pfloat" indexed="true" stored="true" docValues="true"/>
+ <dynamicField name="*_p_f_mv" type="pfloat" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_p_f_mv_dv" type="pfloat" indexed="true" stored="true" docValues="true" multiValued="true"/>
+ <dynamicField name="*_p_f_ni_dv" type="pfloat" indexed="false" stored="true" docValues="true"/>
+ <dynamicField name="*_p_f_ni_mv_dv" type="pfloat" indexed="false" stored="true" docValues="true" multiValued="true"/>
<!-- return DV fields as -->
<dynamicField name="*_p_i_dv_ns" type="pint" indexed="true" stored="false" docValues="true" useDocValuesAsStored="true"/>
- <dynamicField name="*_p_d_dv_ns" type="pdouble" indexed="true" stored="false" docValues="true" useDocValuesAsStored="true"/>
<dynamicField name="*_p_l_dv_ns" type="plong" indexed="true" stored="false" docValues="true" useDocValuesAsStored="true"/>
+ <dynamicField name="*_p_d_dv_ns" type="pdouble" indexed="true" stored="false" docValues="true" useDocValuesAsStored="true"/>
+ <dynamicField name="*_p_f_dv_ns" type="pfloat" indexed="true" stored="false" docValues="true" useDocValuesAsStored="true"/>
<!-- dynamicField name="*_l" type="plong" indexed="true" stored="true"/>
<dynamicField name="*_f" type="pfloat" indexed="true" stored="true"/>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test-files/solr/collection1/conf/schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema.xml b/solr/core/src/test-files/solr/collection1/conf/schema.xml
index 6a84eb9..be1b6f5 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema.xml
@@ -46,8 +46,9 @@
<!-- Point Fields -->
<fieldType name="pint" class="solr.IntPointField" docValues="true"/>
- <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
<fieldType name="plong" class="solr.LongPointField" docValues="true"/>
+ <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
+ <fieldType name="pfloat" class="solr.FloatPointField" docValues="true"/>
<!-- Field type demonstrating an Analyzer failure -->
<fieldType name="failtype1" class="solr.TextField">
@@ -555,7 +556,7 @@
<field name="dateRange" type="dateRange" multiValued="true"/>
<field name="cat" type="string" indexed="true" stored="true" multiValued="true"/>
- <field name="price" type="float" indexed="true" stored="true" multiValued="false"/>
+ <field name="price" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true" multiValued="false"/>
<field name="inStock" type="boolean" indexed="true" stored="true"/>
<field name="subword" type="subword" indexed="true" stored="true"/>
@@ -615,7 +616,7 @@
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_b1" type="boolean" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
- <dynamicField name="*_f1" type="float" indexed="true" stored="true" multiValued="false"/>
+ <dynamicField name="*_f1" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_d1" type="${solr.tests.doubleClass:pdouble}" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
@@ -681,7 +682,7 @@
<dynamicField name="*_f_dv" type="float" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_d_dv" type="double" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_dt_dv" type="date" indexed="true" stored="true" docValues="true"/>
- <dynamicField name="*_f1_dv" type="float" indexed="true" stored="true" docValues="true" multiValued="false"/>
+ <dynamicField name="*_f1_dv" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true" docValues="true" multiValued="false"/>
<!-- Non-stored, DocValues=true -->
<dynamicField name="*_i_dvo" multiValued="false" type="${solr.tests.intClass:pint}" docValues="true" indexed="true" stored="false"
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test-files/solr/collection1/conf/schema11.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema11.xml b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
index 0d90ad6..53f18b8 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema11.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
@@ -80,9 +80,9 @@
<!-- Point Fields -->
<fieldType name="pint" class="solr.IntPointField" docValues="true"/>
- <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
<fieldType name="plong" class="solr.LongPointField" docValues="true"/>
-
+ <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
+ <fieldType name="pfloat" class="solr.FloatPointField" docValues="true"/>
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
is a more restricted form of the canonical representation of dateTime
@@ -348,7 +348,7 @@ valued. -->
<dynamicField name="*_i" type="${solr.tests.intClass:pint}" indexed="true" stored="true"/>
<dynamicField name="*_ii" type="int" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_l" type="${solr.tests.longClass:plong}" indexed="true" stored="true"/>
- <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
+ <dynamicField name="*_f" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true"/>
<dynamicField name="*_d" type="${solr.tests.doubleClass:pdouble}" indexed="true" stored="true"/>
<dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
@@ -357,9 +357,9 @@ valued. -->
<dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
<dynamicField name="*_tl_dv" type="${solr.tests.longClass:plong}" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_tl_ni_dv" type="${solr.tests.longClass:plong}" indexed="false" stored="true" docValues="true"/>
- <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
- <dynamicField name="*_tf_dv" type="tfloat" indexed="true" stored="true" docValues="true"/>
- <dynamicField name="*_tf_ni_dv" type="tfloat" indexed="false" stored="true" docValues="true"/>
+ <dynamicField name="*_tf" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true"/>
+ <dynamicField name="*_tf_dv" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true" docValues="true"/>
+ <dynamicField name="*_tf_ni_dv" type="${solr.tests.floatClass:pfloat}" indexed="false" stored="true" docValues="true"/>
<dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
<dynamicField name="*_td_dv" type="${solr.tests.doubleClass:pdouble}" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_td_ni_dv" type="${solr.tests.doubleClass:pdouble}" indexed="false" stored="true" docValues="true"/>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test-files/solr/collection1/conf/schema12.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema12.xml b/solr/core/src/test-files/solr/collection1/conf/schema12.xml
index 95f6581..6ccc193 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema12.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema12.xml
@@ -45,8 +45,9 @@
<!-- Point Fields -->
<fieldType name="pint" class="solr.IntPointField" docValues="true"/>
- <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
<fieldType name="plong" class="solr.LongPointField" docValues="true"/>
+ <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
+ <fieldType name="pfloat" class="solr.FloatPointField" docValues="true"/>
<!-- Field type demonstrating an Analyzer failure -->
<fieldType name="failtype1" class="solr.TextField">
@@ -437,7 +438,7 @@
<field name="text" type="text" indexed="true" stored="false"/>
<field name="subject" type="text" indexed="true" stored="true"/>
<field name="title" type="nametext" indexed="true" stored="true"/>
- <field name="weight" type="float" indexed="true" stored="true"/>
+ <field name="weight" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true"/>
<field name="bday" type="date" indexed="true" stored="true"/>
<field name="text_np" type="text_np" indexed="true" stored="false"/>
@@ -565,7 +566,7 @@
<dynamicField name="*_t" type="text" indexed="true" stored="true"/>
<dynamicField name="*_tt" type="text" indexed="true" stored="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
- <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
+ <dynamicField name="*_f" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f4c68cdd/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml b/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml
index b74c07f..c6491eb 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml
@@ -215,7 +215,7 @@
<dynamicField name="*_lds" type="long" indexed="true" stored="false" multiValued="true" docValues="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_fs" type="float" indexed="true" stored="true" multiValued="true"/>
- <dynamicField name="*_fd" type="float" indexed="true" stored="false" docValues="true"/>
+ <dynamicField name="*_fd" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="false" docValues="true"/>
<dynamicField name="*_fds" type="float" indexed="true" stored="false" multiValued="true" docValues="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
<dynamicField name="*_ds" type="double" indexed="true" stored="true" multiValued="true"/>
@@ -233,7 +233,7 @@
<dynamicField name="*_sdsS" type="string" indexed="true" stored="true" multiValued="true" docValues="true"/>
<dynamicField name="*_ldS" type="${solr.tests.longClass:plong}" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_ldsS" type="long" indexed="true" stored="true" multiValued="true" docValues="true"/>
- <dynamicField name="*_fdS" type="float" indexed="true" stored="true" docValues="true"/>
+ <dynamicField name="*_fdS" type="${solr.tests.floatClass:pfloat}" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_fdsS" type="float" indexed="true" stored="true" multiValued="true" docValues="true"/>
<dynamicField name="*_ddS" type="${solr.tests.doubleClass:pdouble}" indexed="true" stored="true" docValues="true"/>
<dynamicField name="*_ddsS" type="double" indexed="true" stored="true" multiValued="true" docValues="true"/>
@@ -397,8 +397,9 @@
<!-- Point Fields -->
<fieldType name="pint" class="solr.IntPointField"/>
- <fieldType name="pdouble" class="solr.DoublePointField"/>
<fieldType name="plong" class="solr.LongPointField"/>
+ <fieldType name="pdouble" class="solr.DoublePointField"/>
+ <fieldType name="pfloat" class="solr.FloatPointField"/>
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and