You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/07/29 21:59:55 UTC
[18/28] lucene-solr:jira/solr-6630: Merging master
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java b/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
index ca48f78..eb1031c 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestSchemalessBufferedUpdates.java
@@ -102,7 +102,6 @@ public class TestSchemalessBufferedUpdates extends SolrTestCaseJ4 {
// WARN [...] o.a.s.u.UpdateLog REYPLAY_ERR: IOException reading log
// org.apache.solr.common.SolrException: Invalid Date String:'2017-01-05'
// at org.apache.solr.util.DateMathParser.parseMath(DateMathParser.java:234)
- // at org.apache.solr.schema.TrieField.createField(TrieField.java:725) [...]
updateJ(jsonAdd(processAdd(sdoc("id","2", "f_dt","2017-01-05"))), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
Future<UpdateLog.RecoveryInfo> rinfoFuture = ulog.applyBufferedUpdates();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored2.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored2.java b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored2.java
index 48c30b2..5225988 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored2.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestUseDocValuesAsStored2.java
@@ -88,7 +88,7 @@ public class TestUseDocValuesAsStored2 extends RestTestBase {
" }\n" +
" }\n";
- String response = harness.post("/schema?wt=json", json(payload));
+ String response = harness.post("/schema", json(payload));
Map m = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
assertNull(response, m.get("errors"));
@@ -140,7 +140,7 @@ public class TestUseDocValuesAsStored2 extends RestTestBase {
" 'docValues':true,\n" +
" 'indexed':false\n" +
" }}";
- response = harness.post("/schema?wt=json", json(payload));
+ response = harness.post("/schema", json(payload));
m = TestBulkSchemaAPI.getObj(harness, "a1", "fields");
assertNotNull("field a1 doesn't exist any more", m);
assertEquals(Boolean.FALSE, m.get("useDocValuesAsStored"));
@@ -155,7 +155,7 @@ public class TestUseDocValuesAsStored2 extends RestTestBase {
" 'docValues':true,\n" +
" 'indexed':false\n" +
" }}";
- response = harness.post("/schema?wt=json", json(payload));
+ response = harness.post("/schema", json(payload));
m = TestBulkSchemaAPI.getObj(harness, "a1", "fields");
assertNotNull("field a1 doesn't exist any more", m);
assertEquals(Boolean.TRUE, m.get("useDocValuesAsStored"));
@@ -169,7 +169,7 @@ public class TestUseDocValuesAsStored2 extends RestTestBase {
" 'docValues':true,\n" +
" 'indexed':true\n" +
" }}";
- response = harness.post("/schema?wt=json", json(payload));
+ response = harness.post("/schema", json(payload));
m = TestBulkSchemaAPI.getObj(harness, "a4", "fields");
assertNotNull("field a4 not found", m);
assertEquals(Boolean.TRUE, m.get("useDocValuesAsStored"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/TrieIntPrefixActsAsRangeQueryFieldType.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TrieIntPrefixActsAsRangeQueryFieldType.java b/solr/core/src/test/org/apache/solr/schema/TrieIntPrefixActsAsRangeQueryFieldType.java
index 4b79975..8e31121 100644
--- a/solr/core/src/test/org/apache/solr/schema/TrieIntPrefixActsAsRangeQueryFieldType.java
+++ b/solr/core/src/test/org/apache/solr/schema/TrieIntPrefixActsAsRangeQueryFieldType.java
@@ -22,6 +22,8 @@ import org.apache.solr.search.QParser;
/**
* Custom field type that overrides the prefix query behavior to map "X*" to [X TO Integer.MAX_VALUE].
* * This is used for testing overridden prefix query for custom fields in TestOverriddenPrefixQueryForCustomFieldType
+ *
+ * @see IntPointPrefixActsAsRangeQueryFieldType
*/
public class TrieIntPrefixActsAsRangeQueryFieldType extends TrieIntField {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java b/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
deleted file mode 100644
index 458ac03..0000000
--- a/solr/core/src/test/org/apache/solr/schema/WrappedIntField.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 org.apache.lucene.expressions.Expression;
-import org.apache.lucene.expressions.SimpleBindings;
-import org.apache.lucene.expressions.js.JavascriptCompiler;
-import org.apache.lucene.search.SortField;
-
-/**
- * Custom field wrapping an int, to test sorting via a custom comparator.
- */
-public class WrappedIntField extends TrieIntField {
- Expression expr;
-
- public WrappedIntField() {
- try {
- expr = JavascriptCompiler.compile("payload % 3");
- } catch (Exception e) {
- throw new RuntimeException("impossible?", e);
- }
- }
-
- @Override
- public SortField getSortField(final SchemaField field, final boolean reverse) {
- field.checkSortability();
- SimpleBindings bindings = new SimpleBindings();
- bindings.add(super.getSortField(field, reverse));
- return expr.getSortField(bindings, reverse);
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java b/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
new file mode 100644
index 0000000..c483e8c
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/WrappedIntPointField.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.lucene.expressions.Expression;
+import org.apache.lucene.expressions.SimpleBindings;
+import org.apache.lucene.expressions.js.JavascriptCompiler;
+import org.apache.lucene.search.SortField;
+
+/**
+ * Custom field wrapping an int, to test sorting via a custom comparator.
+ */
+public class WrappedIntPointField extends IntPointField {
+ /** static helper for re-use in sibling trie class */
+ public static SortField getSortField(final SortField superSort, final SchemaField field) {
+ field.checkSortability();
+ Expression expr = null;
+ try {
+ expr = JavascriptCompiler.compile(field.getName() + " % 3");
+ } catch (Exception e) {
+ throw new RuntimeException("impossible?", e);
+ }
+ SimpleBindings bindings = new SimpleBindings();
+ bindings.add(superSort);
+ return expr.getSortField(bindings, superSort.getReverse());
+ }
+
+ @Override
+ public SortField getSortField(final SchemaField field, final boolean reverse) {
+ return getSortField(super.getSortField(field, reverse), field);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java b/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
new file mode 100644
index 0000000..daee484
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/WrappedTrieIntField.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.lucene.search.SortField;
+
+/**
+ * Custom field wrapping an int, to test sorting via a custom comparator.
+ */
+public class WrappedTrieIntField extends TrieIntField {
+ @Override
+ public SortField getSortField(final SchemaField field, final boolean reverse) {
+ return WrappedIntPointField.getSortField(super.getSortField(field, reverse), field);
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
index 3e07bf3..fcd9ee5 100644
--- a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
+++ b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
@@ -27,6 +27,9 @@ public class TestFieldSortValues extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
+ System.setProperty("solr.tests.payload.fieldtype",
+ Boolean.getBoolean(NUMERIC_POINTS_SYSPROP) ?
+ "wrapped_point_int" : "wrapped_trie_int");
initCore("solrconfig-minimal.xml", "schema-field-sort-values.xml");
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java
index a4fa1b8..3f320ce 100644
--- a/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java
+++ b/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java
@@ -84,6 +84,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=0 workers=3 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_s");
params.add("rows","50");
+ params.add("wt", "xml");
HashSet set1 = new HashSet();
String response = h.query(req(params));
@@ -102,6 +103,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=1 workers=3 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_s");
params.add("rows","50");
+ params.add("wt", "xml");
HashSet set2 = new HashSet();
response = h.query(req(params));
@@ -121,6 +123,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=2 workers=3 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_s");
params.add("rows","50");
+ params.add("wt", "xml");
HashSet set3 = new HashSet();
response = h.query(req(params));
@@ -151,6 +154,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=0 workers=2 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_i");
params.add("rows","50");
+ params.add("wt", "xml");
set1 = new HashSet();
response = h.query(req(params));
@@ -169,6 +173,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=1 workers=2 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_i");
params.add("rows","50");
+ params.add("wt", "xml");
set2 = new HashSet();
response = h.query(req(params));
@@ -196,6 +201,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=0 workers=2 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_s, a_i, a_l");
params.add("rows","50");
+ params.add("wt", "xml");
set1 = new HashSet();
response = h.query(req(params));
@@ -214,6 +220,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {
params.add("fq", "{!hash worker=1 workers=2 cost="+getCost(random)+"}");
params.add("partitionKeys", "a_s, a_i, a_l");
params.add("rows","50");
+ params.add("wt", "xml");
set2 = new HashSet();
response = h.query(req(params));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/TestOverriddenPrefixQueryForCustomFieldType.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestOverriddenPrefixQueryForCustomFieldType.java b/solr/core/src/test/org/apache/solr/search/TestOverriddenPrefixQueryForCustomFieldType.java
index 15012cc..73fa928 100644
--- a/solr/core/src/test/org/apache/solr/search/TestOverriddenPrefixQueryForCustomFieldType.java
+++ b/solr/core/src/test/org/apache/solr/search/TestOverriddenPrefixQueryForCustomFieldType.java
@@ -36,6 +36,10 @@ public class TestOverriddenPrefixQueryForCustomFieldType extends SolrTestCaseJ4
@BeforeClass
public static void beforeClass() throws Exception {
+ System.setProperty("solr.tests.CustomIntFieldType",
+ (Boolean.getBoolean(NUMERIC_POINTS_SYSPROP)
+ ? "solr.IntPointPrefixActsAsRangeQueryFieldType"
+ : "solr.TrieIntPrefixActsAsRangeQueryFieldType"));
initCore("solrconfig-basic.xml", "schema-customfield.xml");
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java b/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
index 6591218..763c8d5 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRangeQuery.java
@@ -16,20 +16,33 @@
*/
package org.apache.solr.search;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
import org.apache.lucene.util.TestUtil;
-
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.ResultContext;
import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.schema.FieldType;
+import org.apache.solr.schema.NumberType;
+import org.apache.solr.schema.StrField;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.*;
-
public class TestRangeQuery extends SolrTestCaseJ4 {
+
+ private final static long DATE_START_TIME_RANDOM_TEST = 1499797224224L;
+ private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ROOT);
@BeforeClass
public static void beforeClass() throws Exception {
@@ -385,6 +398,292 @@ public class TestRangeQuery extends SolrTestCaseJ4 {
expectThrows(SyntaxError.class, () -> QParser.getParser("[A TO]", req("df", "text")).getQuery());
}
+ public void testCompareTypesRandomRangeQueries() throws Exception {
+ int cardinality = 10000;
+ Map<NumberType,String[]> types = new HashMap<>(); //single and multivalued field types
+ Map<NumberType,String[]> typesMv = new HashMap<>(); // multivalued field types only
+ types.put(NumberType.INTEGER, new String[]{"ti", "ti_dv", "ti_ni_dv", "i_p", "i_ni_p", "i_ndv_p", "tis", "tis_dv", "tis_ni_dv", "is_p", "is_ni_p", "is_ndv_p"});
+ types.put(NumberType.LONG, new String[]{"tl", "tl_dv", "tl_ni_dv", "l_p", "l_ni_p", "l_ndv_p", "tls", "tls_dv", "tls_ni_dv", "ls_p", "ls_ni_p", "ls_ndv_p"});
+ types.put(NumberType.FLOAT, new String[]{"tf", "tf_dv", "tf_ni_dv", "f_p", "f_ni_p", "f_ndv_p", "tfs", "tfs_dv", "tfs_ni_dv", "fs_p", "fs_ni_p", "fs_ndv_p"});
+ types.put(NumberType.DOUBLE, new String[]{"td", "td_dv", "td_ni_dv", "d_p", "d_ni_p", "d_ndv_p", "tds", "tds_dv", "tds_ni_dv", "ds_p", "ds_ni_p", "ds_ndv_p"});
+ types.put(NumberType.DATE, new String[]{"tdt", "tdt_dv", "tdt_ni_dv", "dt_p", "dt_ni_p", "dt_ndv_p", "tdts", "tdts_dv", "tdts_ni_dv", "dts_p", "dts_ni_p", "dts_ndv_p"});
+ typesMv.put(NumberType.INTEGER, new String[]{"tis", "tis_dv", "tis_ni_dv", "is_p", "is_ni_p", "is_ndv_p"});
+ typesMv.put(NumberType.LONG, new String[]{"tls", "tls_dv", "tls_ni_dv", "ls_p", "ls_ni_p", "ls_ndv_p"});
+ typesMv.put(NumberType.FLOAT, new String[]{"tfs", "tfs_dv", "tfs_ni_dv", "fs_p", "fs_ni_p", "fs_ndv_p"});
+ typesMv.put(NumberType.DOUBLE, new String[]{"tds", "tds_dv", "tds_ni_dv", "ds_p", "ds_ni_p", "ds_ndv_p"});
+ typesMv.put(NumberType.DATE, new String[]{"tdts", "tdts_dv", "tdts_ni_dv", "dts_p", "dts_ni_p", "dts_ndv_p"});
+
+ for (int i = 0; i < atLeast(500); i++) {
+ if (random().nextInt(50) == 0) {
+ //have some empty docs
+ assertU(adoc("id", String.valueOf(i)));
+ continue;
+ }
+
+ if (random().nextInt(100) == 0 && i > 0) {
+ //delete some docs
+ assertU(delI(String.valueOf(i - 1)));
+ }
+ SolrInputDocument document = new SolrInputDocument();
+ document.setField("id", i);
+ for (Map.Entry<NumberType,String[]> entry:types.entrySet()) {
+ NumberType type = entry.getKey();
+ String val = null;
+ List<String> vals = null;
+ switch (type) {
+ case DATE:
+ val = randomDate(cardinality);
+ vals = getRandomDates(random().nextInt(10), cardinality);
+ break;
+ case DOUBLE:
+ val = String.valueOf(randomDouble(cardinality));
+ vals = toStringList(getRandomDoubles(random().nextInt(10), cardinality));
+ break;
+ case FLOAT:
+ val = String.valueOf(randomFloat(cardinality));
+ vals = toStringList(getRandomFloats(random().nextInt(10), cardinality));
+ break;
+ case INTEGER:
+ val = String.valueOf(randomInt(cardinality));
+ vals = toStringList(getRandomInts(random().nextInt(10), cardinality));
+ break;
+ case LONG:
+ val = String.valueOf(randomLong(cardinality));
+ vals = toStringList(getRandomLongs(random().nextInt(10), cardinality));
+ break;
+ default:
+ throw new AssertionError();
+
+ }
+ // SingleValue
+ for (String fieldSuffix:entry.getValue()) {
+ document.setField("field_sv_" + fieldSuffix, val);
+ }
+ // MultiValue
+ for (String fieldSuffix:typesMv.get(type)) {
+ for (String value:vals) {
+ document.addField("field_mv_" + fieldSuffix, value);
+ }
+ }
+ }
+
+ assertU(adoc(document));
+ if (random().nextInt(50) == 0) {
+ assertU(commit());
+ }
+ }
+ assertU(commit());
+
+ String[][] possibleTypes = new String[types.size()][];
+ types.values().toArray(possibleTypes);
+ String[][] possibleTypesMv = new String[typesMv.size()][];
+ typesMv.values().toArray(possibleTypesMv);
+ for (int i = 0; i < atLeast(1000); i++) {
+ doTestQuery(cardinality, false, pickRandom(possibleTypes));
+ doTestQuery(cardinality, true, pickRandom(possibleTypesMv));
+ }
+ }
+
+ private void doTestQuery(int cardinality, boolean mv, String[] types) throws Exception {
+ String[] startOptions = new String[]{"{", "["};
+ String[] endOptions = new String[]{"}", "]"};
+ String[] qRange = getRandomRange(cardinality, types[0]);
+ String start = pickRandom(startOptions);
+ String end = pickRandom(endOptions);
+ long expectedHits = doRangeQuery(mv, start, end, types[0], qRange);
+ for (int i = 1; i < types.length; i++) {
+ assertEquals("Unexpected results from query when comparing " + types[0] + " with " + types[i] + " and query: " +
+ start + qRange[0] + " TO " + qRange[1] + end + "\n",
+ expectedHits, doRangeQuery(mv, start, end, types[i], qRange));
+ }
+ }
+
+ private long doRangeQuery(boolean mv, String start, String end, String field, String[] qRange) throws Exception {
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.set("q", "field_" + (mv?"mv_":"sv_") + field + ":" + start + qRange[0] + " TO " + qRange[1] + end);
+ SolrQueryRequest req = req(params);
+ try {
+ return (long) h.queryAndResponse("", req).getToLog().get("hits");
+ } finally {
+ req.close();
+ }
+
+ }
+
+ private String[] getRandomRange(int max, String fieldName) {
+ Number[] values = new Number[2];
+ FieldType ft = h.getCore().getLatestSchema().getField("field_" + fieldName).getType();
+ if (ft.getNumberType() == null) {
+ assert ft instanceof StrField;
+ values[0] = randomInt(max);
+ values[1] = randomInt(max);
+ Arrays.sort(values, (o1, o2) -> String.valueOf(o1).compareTo(String.valueOf(o2)));
+ } else {
+ switch (ft.getNumberType()) {
+ case DOUBLE:
+ values[0] = randomDouble(max);
+ values[1] = randomDouble(max);
+ break;
+ case FLOAT:
+ values[0] = randomFloat(max);
+ values[1] = randomFloat(max);
+ break;
+ case INTEGER:
+ values[0] = randomInt(max);
+ values[1] = randomInt(max);
+ break;
+ case LONG:
+ values[0] = randomLong(max);
+ values[1] = randomLong(max);
+ break;
+ case DATE:
+ values[0] = randomMs(max);
+ values[1] = randomMs(max);
+ break;
+ default:
+ throw new AssertionError("Unexpected number type");
+
+ }
+ if (random().nextInt(100) >= 1) {// sometimes don't sort the values. Should result in 0 hits
+ Arrays.sort(values);
+ }
+ }
+ String[] stringValues = new String[2];
+ if (rarely()) {
+ stringValues[0] = "*";
+ } else {
+ if (ft.getNumberType() == NumberType.DATE) {
+ stringValues[0] = dateFormat.format(values[0]);
+ } else {
+ stringValues[0] = String.valueOf(values[0]);
+ }
+ }
+ if (rarely()) {
+ stringValues[1] = "*";
+ } else {
+ if (ft.getNumberType() == NumberType.DATE) {
+ stringValues[1] = dateFormat.format(values[1]);
+ } else {
+ stringValues[1] = String.valueOf(values[1]);
+ }
+ }
+ return stringValues;
+ }
+
+
+ // Helper methods
+ private String randomDate(int cardinality) {
+ return dateFormat.format(new Date(randomMs(cardinality)));
+ }
+
+ private List<String> getRandomDates(int numValues, int cardinality) {
+ List<String> vals = new ArrayList<>(numValues);
+ for (int i = 0; i < numValues;i++) {
+ vals.add(randomDate(cardinality));
+ }
+ return vals;
+ }
+
+ private List<Double> getRandomDoubles(int numValues, int cardinality) {
+ List<Double> vals = new ArrayList<>(numValues);
+ for (int i = 0; i < numValues;i++) {
+ vals.add(randomDouble(cardinality));
+ }
+ return vals;
+ }
+
+ private List<Float> getRandomFloats(int numValues, int cardinality) {
+ List<Float> vals = new ArrayList<>(numValues);
+ for (int i = 0; i < numValues;i++) {
+ vals.add(randomFloat(cardinality));
+ }
+ return vals;
+ }
+
+ private List<Integer> getRandomInts(int numValues, int cardinality) {
+ List<Integer> vals = new ArrayList<>(numValues);
+ for (int i = 0; i < numValues;i++) {
+ vals.add(randomInt(cardinality));
+ }
+ return vals;
+ }
+
+ private List<Long> getRandomLongs(int numValues, int cardinality) {
+ List<Long> vals = new ArrayList<>(numValues);
+ for (int i = 0; i < numValues;i++) {
+ vals.add(randomLong(cardinality));
+ }
+ return vals;
+ }
+
+ <T> List<String> toStringList(List<T> input) {
+ List<String> newList = new ArrayList<>(input.size());
+ for (T element:input) {
+ newList.add(String.valueOf(element));
+ }
+ return newList;
+ }
+
+ long randomMs(int cardinality) {
+ return DATE_START_TIME_RANDOM_TEST + random().nextInt(cardinality) * 1000 * (random().nextBoolean()?1:-1);
+ }
+
+ double randomDouble(int cardinality) {
+ if (rarely()) {
+ int num = random().nextInt(8);
+ if (num == 0) return Double.NEGATIVE_INFINITY;
+ if (num == 1) return Double.POSITIVE_INFINITY;
+ if (num == 2) return Double.MIN_VALUE;
+ if (num == 3) return Double.MAX_VALUE;
+ if (num == 4) return -Double.MIN_VALUE;
+ if (num == 5) return -Double.MAX_VALUE;
+ if (num == 6) return 0.0d;
+ if (num == 7) return -0.0d;
+ }
+ Double d = Double.NaN;
+ while (d.isNaN()) {
+ d = random().nextDouble();
+ }
+ return d * cardinality * (random().nextBoolean()?1:-1);
+ }
+
+ float randomFloat(int cardinality) {
+ if (rarely()) {
+ int num = random().nextInt(8);
+ if (num == 0) return Float.NEGATIVE_INFINITY;
+ if (num == 1) return Float.POSITIVE_INFINITY;
+ if (num == 2) return Float.MIN_VALUE;
+ if (num == 3) return Float.MAX_VALUE;
+ if (num == 4) return -Float.MIN_VALUE;
+ if (num == 5) return -Float.MAX_VALUE;
+ if (num == 6) return 0.0f;
+ if (num == 7) return -0.0f;
+ }
+ Float f = Float.NaN;
+ while (f.isNaN()) {
+ f = random().nextFloat();
+ }
+ return f * cardinality * (random().nextBoolean()?1:-1);
+ }
+
+ int randomInt(int cardinality) {
+ if (rarely()) {
+ int num = random().nextInt(2);
+ if (num == 0) return Integer.MAX_VALUE;
+ if (num == 1) return Integer.MIN_VALUE;
+ }
+ return random().nextInt(cardinality) * (random().nextBoolean()?1:-1);
+ }
+
+ long randomLong(int cardinality) {
+ if (rarely()) {
+ int num = random().nextInt(2);
+ if (num == 0) return Long.MAX_VALUE;
+ if (num == 1) return Long.MIN_VALUE;
+ }
+ return randomInt(cardinality);
+ }
+
static boolean sameDocs(String msg, DocSet a, DocSet b) {
DocIterator i = a.iterator();
// System.out.println("SIZES="+a.size() + "," + b.size());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
index 4cee94b..afc8a0d 100644
--- a/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
+++ b/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
@@ -293,11 +293,8 @@ public class TestFunctionQuery extends SolrTestCaseJ4 {
@Test
public void testExternalFileFieldNumericKey() throws Exception {
- assumeFalse("SOLR-10846: ExternalFileField/FileFloatSource throws NPE if keyField is Points based",
- Boolean.getBoolean(NUMERIC_POINTS_SYSPROP));
-
final String extField = "eff_trie";
- final String keyField = "eff_ti";
+ final String keyField = "eff_tint";
assertU(adoc("id", "991", keyField, "91"));
assertU(adoc("id", "992", keyField, "92"));
assertU(adoc("id", "993", keyField, "93"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java b/solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java
index 357363c..22e532c 100644
--- a/solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java
+++ b/solr/core/src/test/org/apache/solr/search/join/GraphQueryTest.java
@@ -18,8 +18,6 @@ package org.apache.solr.search.join;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.request.SolrQueryRequest;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -28,89 +26,91 @@ public class GraphQueryTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeTests() throws Exception {
- initCore("solrconfig.xml","schema-graph.xml");
+ initCore("solrconfig.xml","schema_latest.xml");
}
-
+
@Test
public void testGraph() throws Exception {
- // 1 -> 2 -> 3 -> ( 4 5 )
- // 7 -> 1
- // 8 -> ( 1 2 )
- assertU(adoc("id", "doc_1", "node_id", "1", "edge_id", "2", "text", "foo", "title", "foo10"));
- assertU(adoc("id", "doc_2", "node_id", "2", "edge_id", "3", "text", "foo"));
+ // normal strings
+ doGraph( params("node_id","node_s", "edge_id","edge_ss") );
+
+ // point based fields with docvalues
+ doGraph( params("node_id","node_ip", "edge_id","edge_ips") );
+ doGraph( params("node_id","node_lp", "edge_id","edge_lps") );
+ doGraph( params("node_id","node_fp", "edge_id","edge_fps") );
+ doGraph( params("node_id","node_dp", "edge_id","edge_dps") );
+ }
+
+ public void doGraph(SolrParams p) throws Exception {
+ String node_id = p.get("node_id");
+ String edge_id = p.get("edge_id");
+
+ // NOTE: from/to fields are reversed from {!join}... values are looked up in the "toField" and then matched on the "fromField"
+ // 1->2->(3,9)->(4,5)->7
+ // 8->(1,2)->...
+ assertU(adoc("id", "doc_1", node_id, "1", edge_id, "2", "text", "foo", "title", "foo10" ));
+ assertU(adoc("id", "doc_2", node_id, "2", edge_id, "3", "text", "foo" ));
assertU(commit());
- assertU(adoc("id", "doc_3", "node_id", "3", "edge_id", "4", "edge_id", "5", "table", "foo"));
- assertU(adoc("id", "doc_4", "node_id", "4", "table", "foo"));
+ assertU(adoc("id", "doc_3", node_id, "3", edge_id, "4", edge_id, "5"));
+ assertU(adoc("id", "doc_4", node_id, "4" ));
assertU(commit());
- assertU(adoc("id", "doc_5", "node_id", "5", "edge_id", "7", "table", "bar"));
- assertU(adoc("id", "doc_6", "node_id", "6", "edge_id", "3" ));
- assertU(adoc("id", "doc_7", "node_id", "7", "edge_id", "1" ));
- assertU(adoc("id", "doc_8", "node_id", "8", "edge_id", "1", "edge_id", "2" ));
- assertU(adoc("id", "doc_9", "node_id", "9"));
+ assertU(adoc("id", "doc_5", node_id, "5", edge_id, "7" ));
+ assertU(adoc("id", "doc_6", node_id, "6", edge_id, "3" ));
+ assertU(adoc("id", "doc_7", node_id, "7", edge_id, "1" ));
+ assertU(adoc("id", "doc_8", node_id, "8", edge_id, "1", edge_id, "2" ));
+ assertU(adoc("id", "doc_9", node_id, "9"));
assertU(commit());
// update docs so they're in a new segment.
- assertU(adoc("id", "doc_1", "node_id", "1", "edge_id", "2", "text", "foo"));
- assertU(adoc("id", "doc_2", "node_id", "2", "edge_id", "3", "edge_id", "9", "text", "foo11"));
+ assertU(adoc("id", "doc_1", node_id, "1", edge_id, "2", "text", "foo"));
+ assertU(adoc("id", "doc_2", node_id, "2", edge_id, "3", edge_id, "9", "text", "foo11"));
assertU(commit());
// a graph for testing traversal filter 10 - 11 -> (12 | 13)
- assertU(adoc("id", "doc_10", "node_id", "10", "edge_id", "11", "title", "foo"));
- assertU(adoc("id", "doc_11", "node_id", "11", "edge_id", "12", "edge_id", "13", "text", "foo11"));
- assertU(adoc("id", "doc_12", "node_id", "12", "text", "foo10"));
- assertU(adoc("id", "doc_13", "node_id", "13", "edge_id", "12", "text", "foo10"));
+ assertU(adoc("id", "doc_10", node_id, "10", edge_id, "11", "title", "foo"));
+ assertU(adoc("id", "doc_11", node_id, "11", edge_id, "12", edge_id, "13", "text", "foo11"));
+ assertU(adoc("id", "doc_12", node_id, "12", "text", "foo10"));
+ assertU(adoc("id", "doc_13", node_id, "13", edge_id, "12", "text", "foo10"));
assertU(commit());
// Now we have created a simple graph
// start traversal from node id to edge id
- String gQuery = "{!graph from=\"node_id\" to=\"edge_id\"}id:doc_1";
- SolrQueryRequest qr = createRequest(gQuery);
- assertQ(qr,"//*[@numFound='7']");
-
- String g2Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"true\" returnOnlyLeaf=\"false\"}id:doc_8";
- qr = createRequest(g2Query);
- assertQ(qr,"//*[@numFound='8']");
- String g3Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"false\" returnOnlyLeaf=\"false\"}id:doc_8";
- qr = createRequest(g3Query);
- assertQ(qr,"//*[@numFound='7']");
-
- String g4Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"true\" returnOnlyLeaf=\"false\" traversalFilter=\"text:foo11\"}id:doc_8";
- qr = createRequest(g4Query);
- assertQ(qr,"//*[@numFound='2']");
-
- String g5Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"true\" returnOnlyLeaf=\"false\" maxDepth=0}id:doc_8";
- qr = createRequest(g5Query);
- assertQ(qr,"//*[@numFound='1']");
-
- String g6Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"true\" returnOnlyLeaf=\"false\" maxDepth=1}id:doc_8";
- qr = createRequest(g6Query);
- assertQ(qr,"//*[@numFound='3']");
-
- String g7Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"false\" returnOnlyLeaf=\"false\" maxDepth=1}id:doc_8";
- qr = createRequest(g7Query);
- assertQ(qr,"//*[@numFound='2']");
+ // TODO: assert which documents actually come back
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id}}id:doc_1")
+ , "/response/numFound==7"
+ );
- String g8Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=\"false\" returnOnlyLeaf=\"true\" maxDepth=2}id:doc_8";
- qr = createRequest(g8Query);
- assertQ(qr,"//*[@numFound='1']");
-
- String g9Query = "{!graph from=\"node_id\" to=\"edge_id\" maxDepth=1}id:doc_1";
- qr = createRequest(g9Query);
- assertQ(qr,"//*[@numFound='2']");
-
- String g10Query = "{!graph from=\"node_id\" to=\"edge_id\" returnRoot=false maxDepth=1}id:doc_1";
- qr = createRequest(g10Query);
- assertQ(qr,"//*[@numFound='1']");
- }
+ // reverse the order to test single/multi-valued on the opposite fields
+ // start with doc1, look up node_id (1) and match to edge_id (docs 7 and 8)
+ assertJQ(req(p, "q","{!graph from=${edge_id} to=${node_id} maxDepth=1}id:doc_1")
+ , "/response/numFound==3"
+ );
- private SolrQueryRequest createRequest(String query) {
- SolrQueryRequest qr = req(query);
- NamedList<Object> par = qr.getParams().toNamedList();
- par.add("debug", "true");
- par.add("rows", "10");
- par.add("fl", "id,node_id,edge_id");
- par.remove("qt");
- SolrParams newp = SolrParams.toSolrParams(par);
- qr.setParams(newp);
- return qr;
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=true returnOnlyLeaf=false}id:doc_8")
+ , "/response/numFound==8"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=false returnOnlyLeaf=false}id:doc_8")
+ , "/response/numFound==7"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=true returnOnlyLeaf=false traversalFilter='text:foo11'}id:doc_8")
+ , "/response/numFound==2"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=true returnOnlyLeaf=false maxDepth=0}id:doc_8")
+ , "/response/numFound==1"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=true returnOnlyLeaf=false maxDepth=1}id:doc_8")
+ , "/response/numFound==3"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=false returnOnlyLeaf=false maxDepth=1}id:doc_8")
+ , "/response/numFound==2"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=false returnOnlyLeaf=true maxDepth=2}id:doc_8")
+ , "/response/numFound==1"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} maxDepth=1}id:doc_1")
+ , "/response/numFound==2"
+ );
+ assertJQ(req(p, "q","{!graph from=${node_id} to=${edge_id} returnRoot=false maxDepth=1}id:doc_1")
+ , "/response/numFound==1"
+ );
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
index 157f61a..385084f 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -203,7 +203,7 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: true}}", "harry", "HarryIsUberCool");
verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/blockUnknown", "true", 20, "harry", "HarryIsUberCool");
- verifySecurityStatus(cl, baseUrl + "/admin/info/key?wt=json", "key", NOT_NULL_PREDICATE, 20);
+ verifySecurityStatus(cl, baseUrl + "/admin/info/key", "key", NOT_NULL_PREDICATE, 20);
String[] toolArgs = new String[]{
"status", "-solr", baseUrl};
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/servlet/HttpSolrCallGetCoreTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/servlet/HttpSolrCallGetCoreTest.java b/solr/core/src/test/org/apache/solr/servlet/HttpSolrCallGetCoreTest.java
index bd851eb..ae683e5 100644
--- a/solr/core/src/test/org/apache/solr/servlet/HttpSolrCallGetCoreTest.java
+++ b/solr/core/src/test/org/apache/solr/servlet/HttpSolrCallGetCoreTest.java
@@ -120,7 +120,7 @@ public class HttpSolrCallGetCoreTest extends SolrCloudTestCase {
@Override
public String getQueryString() {
- return "wt=json&version=2";
+ return "version=2";
}
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
index bd84d32..30496d1 100644
--- a/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
+++ b/solr/core/src/test/org/apache/solr/update/SoftAutoCommitTest.java
@@ -17,6 +17,7 @@
package org.apache.solr.update;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
import static org.junit.Assert.assertEquals;
import java.lang.invoke.MethodHandles;
@@ -340,74 +341,85 @@ public class SoftAutoCommitTest extends AbstractSolrTestCase {
hardTracker.setOpenSearcher(false);
// try to add 5 docs really fast
- long fast5start = System.nanoTime();
+
+ final long preFirstNanos = System.nanoTime();
for( int i=0;i<5; i++ ) {
assertU(adoc("id", ""+500 + i, "subject", "five fast docs"));
}
- long fast5end = System.nanoTime() - TimeUnit.NANOSECONDS.convert(300, TimeUnit.MILLISECONDS); // minus a tad of slop
- long fast5time = 1 + TimeUnit.MILLISECONDS.convert(fast5end - fast5start, TimeUnit.NANOSECONDS);
-
- // total time for all 5 adds determines the number of soft to expect
- long expectedSoft = (long)Math.ceil((double) fast5time / softCommitWaitMillis);
- long expectedHard = (long)Math.ceil((double) fast5time / hardCommitWaitMillis);
+ final long postLastNanos = System.nanoTime();
- expectedSoft = Math.max(1, expectedSoft);
- expectedHard = Math.max(1, expectedHard);
-
- // note: counting from 1 for multiplication
- for (int i = 1; i <= expectedSoft; i++) {
- // Wait for the soft commit with plenty of fudge to survive nasty envs
- Long soft = monitor.soft.poll(softCommitWaitMillis * 3, MILLISECONDS);
- if (soft != null || i == 1) {
- assertNotNull(i + ": soft wasn't fast enough", soft);
- monitor.assertSaneOffers();
-
- // have to assume none of the docs were added until
- // very end of the add window
- long softMs = TimeUnit.MILLISECONDS.convert(soft - fast5end, TimeUnit.NANOSECONDS);
- assertTrue(i + ": soft occurred too fast: " +
- softMs + " < (" + softCommitWaitMillis + " * " + i + ")",
- softMs >= (softCommitWaitMillis * i));
- } else {
- // we may have guessed wrong and there were fewer commits
- assertNull("Got a soft commit we weren't expecting", monitor.soft.poll(2000, MILLISECONDS));
- }
- }
+ monitor.assertSaneOffers();
- // note: counting from 1 for multiplication
- for (int i = 1; i <= expectedHard; i++) {
- // wait for the hard commit, shouldn't need any fudge given
- // other actions already taken
- Long hard = monitor.hard.poll(hardCommitWaitMillis, MILLISECONDS);
- assertNotNull(i + ": hard wasn't fast enough", hard);
- monitor.assertSaneOffers();
-
- // have to assume none of the docs were added until
- // very end of the add window
- long hardMs = TimeUnit.MILLISECONDS.convert(hard - fast5end, TimeUnit.NANOSECONDS);
- assertTrue(i + ": hard occurred too fast: " +
- hardMs + " < (" + hardCommitWaitMillis + " * " + i + ")",
- hardMs >= (hardCommitWaitMillis * i));
- }
+ final long maxTimeMillis = MILLISECONDS.convert(postLastNanos - preFirstNanos, NANOSECONDS);
+ log.info("maxTimeMillis: {}ns - {}ns == {}ms", postLastNanos, preFirstNanos, maxTimeMillis);
- // we are only guessing how many commits we may see, allow one extra of each
- monitor.soft.poll(softCommitWaitMillis + 200, MILLISECONDS);
- monitor.hard.poll(hardCommitWaitMillis + 200, MILLISECONDS);
-
- // clear commits
- monitor.hard.clear();
- monitor.soft.clear();
+ // NOTE: explicitly using truncated division of longs to round down
+ // even if evenly divisible, need +1 to account for possible "last" commit triggered by "last" doc
+ final long maxExpectedSoft = 1L + (maxTimeMillis / softCommitWaitMillis);
+ final long maxExpectedHard = 1L + (maxTimeMillis / hardCommitWaitMillis);
+
+ log.info("maxExpectedSoft={}", maxExpectedSoft);
+ log.info("maxExpectedHard={}", maxExpectedHard);
+
+ // do a loop pool over each monitor queue, asserting that:
+ // - we get at least one commit
+ // - we don't get more then the max possible commits expected
+ // - any commit we do get doesn't happen "too fast" relative the previous commit
+ // (or first doc added for the first commit)
+ monitor.assertSaneOffers();
+ assertRapidMultiCommitQueues("softCommit", preFirstNanos, softCommitWaitMillis,
+ maxExpectedSoft, monitor.soft);
+ monitor.assertSaneOffers();
+ assertRapidMultiCommitQueues("hardCommit", preFirstNanos, hardCommitWaitMillis,
+ maxExpectedHard, monitor.hard);
+
+ // now wait a bit...
+ // w/o other action we shouldn't see any additional hard/soft commits
- // wait a bit, w/o other action we shouldn't see any
- // new hard/soft commits
assertNull("Got a hard commit we weren't expecting",
- monitor.hard.poll(1000, MILLISECONDS));
+ monitor.hard.poll(1000, MILLISECONDS));
assertNull("Got a soft commit we weren't expecting",
- monitor.soft.poll(0, MILLISECONDS));
+ monitor.soft.poll(0, MILLISECONDS));
monitor.assertSaneOffers();
}
+
+ /**
+ * Helper method
+ * @see #testSoftAndHardCommitMaxTimeRapidAdds
+ */
+ private static void assertRapidMultiCommitQueues
+ (final String debug, final long startTimestampNanos, final long commitWaitMillis,
+ final long maxNumCommits, final BlockingQueue<Long> queue) throws InterruptedException {
+
+ assert 0 < maxNumCommits;
+
+ // do all our math/comparisons in Nanos...
+ final long commitWaitNanos = NANOSECONDS.convert(commitWaitMillis, MILLISECONDS);
+
+ // these will be modified in each iteration of our assertion loop
+ long prevTimestampNanos = startTimestampNanos;
+ int count = 1;
+ Long commitNanos = queue.poll(commitWaitMillis * 3, MILLISECONDS);
+ assertNotNull(debug + ": did not find a single commit", commitNanos);
+
+ while (null != commitNanos) {
+ if (commitNanos < prevTimestampNanos + commitWaitMillis) {
+ fail(debug + ": commit#" + count + " has TS too low relative to previous TS & commitWait: " +
+ "commitNanos=" + commitNanos + ", prevTimestampNanos=" + prevTimestampNanos +
+ ", commitWaitMillis=" + commitWaitMillis);
+ }
+ if (maxNumCommits < count) {
+ fail(debug + ": commit#" + count + " w/ commitNanos=" + commitNanos +
+ ", but maxNumCommits=" +maxNumCommits);
+ }
+
+ prevTimestampNanos = commitNanos;
+ count++;
+ commitNanos = queue.poll(commitWaitMillis * 3, MILLISECONDS);
+ }
+ }
}
class MockEventListener implements SolrEventListener {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java
index 4534937..999d70b 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java
@@ -209,7 +209,10 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
List<Thread> threads = new ArrayList<>(100);
int finalCount = 0; //int_i
- for (int i = 0; i < 100; i++) {
+ AtomicUpdateProcessorFactory factory = new AtomicUpdateProcessorFactory();
+ factory.inform(h.getCore());
+
+ for (int i = 0; i < 10; i++) {
int index = random().nextInt(5);
Thread t = new Thread() {
@Override
@@ -229,8 +232,6 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
cmd.solrDoc.addField("int_i", index);
try {
- AtomicUpdateProcessorFactory factory = new AtomicUpdateProcessorFactory();
- factory.inform(h.getCore());
factory.getInstance(cmd.getReq(), new SolrQueryResponse(),
new DistributedUpdateProcessor(cmd.getReq(), new SolrQueryResponse(),
new RunUpdateProcessor(cmd.getReq(), null))).processAdd(cmd);
@@ -238,14 +239,12 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
}
}
};
- t.run();
threads.add(t);
+ t.start();
finalCount += index; //int_i
}
- for (Thread thread: threads) {
- thread.join();
- }
+ for (Thread thread: threads) thread.join();
assertU(commit());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
index 19780df..fefbe5d 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdatesTest.java
@@ -24,7 +24,6 @@ import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.schema.TrieDateField;
import org.apache.solr.util.DateMathParser;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -615,7 +614,6 @@ public class AtomicUpdatesTest extends SolrTestCaseJ4 {
doc = new SolrInputDocument();
doc.setField("id", "10001");
- TrieDateField trieDF = new TrieDateField();
Date tempDate = DateMathParser.parseMath(null, "2014-02-01T12:00:00Z");
doc.setField("dateRemove", new Date[]{DateMathParser.parseMath(null, "2014-02-01T12:00:00Z"),
DateMathParser.parseMath(null, "2014-07-02T12:00:00Z"),
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/update/processor/TestNamedUpdateProcessors.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/TestNamedUpdateProcessors.java b/solr/core/src/test/org/apache/solr/update/processor/TestNamedUpdateProcessors.java
index 3242c09..8db4f96 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/TestNamedUpdateProcessors.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/TestNamedUpdateProcessors.java
@@ -82,10 +82,10 @@ public class TestNamedUpdateProcessors extends AbstractFullDistribZkTestBase {
"'add-runtimelib' : { 'name' : 'colltest' ,'version':1}\n" +
"}";
RestTestHarness client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(client, "/config", payload);
TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "runtimeLib", blobName, "version"),
1l, 10);
@@ -97,11 +97,11 @@ public class TestNamedUpdateProcessors extends AbstractFullDistribZkTestBase {
"}";
client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(client, "/config", payload);
for (RestTestHarness restTestHarness : restTestHarnesses) {
TestSolrConfigHandler.testForResponseElement(restTestHarness,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "updateProcessor", "firstFld", "fieldName"),
"test_s", 10);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java b/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java
index 2b10953..e57e0ef 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java
@@ -16,10 +16,16 @@
*/
package org.apache.solr.update.processor;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
@@ -28,23 +34,20 @@ import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.AddUpdateCommand;
import org.junit.BeforeClass;
-import java.io.IOException;
-import java.util.Date;
-import java.util.UUID;
-
public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
+ Date now = new Date();
+
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig-update-processor-chains.xml", "schema.xml");
}
public void testFallbackToUnique() throws Exception {
- Date now = new Date();
// get all defaults
SolrInputDocument d = processAdd("default-values-fallback-to-unique",
- doc(f("name", "Existing", "Values")));
+ doc(f("name", "Existing", "Values")));
assertNotNull(d);
@@ -62,18 +65,18 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
// defaults already specified
d = processAdd("default-values-fallback-to-unique",
- doc(f("timestamp", now),
- f("id", "550e8400-e29b-41d4-a716-446655440000"),
- f("processor_default_s", "I HAVE A VALUE"),
- f("processor_default_i", 12345),
- f("name", "Existing", "Values")));
+ doc(f("timestamp", now),
+ f("id", "550e8400-e29b-41d4-a716-446655440000"),
+ f("processor_default_s", "I HAVE A VALUE"),
+ f("processor_default_i", 12345),
+ f("name", "Existing", "Values")));
assertNotNull(d);
assertEquals("550e8400-e29b-41d4-a716-446655440000",
- d.getFieldValue("id"));
+ d.getFieldValue("id"));
- // defaults already specified
+ // defaults already specified //both config and request param not passed.
d = processAdd("default-values-fallback-to-unique-automatically",
doc(f("timestamp", now),
f("id", "550e8400-e29b-41d4-a716-446655440000"),
@@ -88,8 +91,52 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
assertEquals(121, d.getFieldValue("processor_default_i"));
}
+ public void testRequesTParams() throws Exception {
+ SolrInputDocument d = processAdd(null,
+ doc(f("name", "Existing", "Values"), f( "id","75765")), params("processor", "uuid", "uuid.fieldName", "id_s"));
+
+ assertNotNull(d);
+
+ assertNotNull(d.getFieldValue("id_s"));
+ assertNotNull(UUID.fromString(d.getFieldValue("id_s").toString()));
+
+
+
+ // defaults already specified
+ d = processAdd(null,
+ doc(f("timestamp", now),
+ f("id", "454435"),
+ f("id_s", "550e8400-e29b-41d4-a716-446655440000"),
+ f("processor_default_s", "I HAVE A VALUE"),
+ f("processor_default_i", 121),
+ f("name", "Existing", "Values"))
+ , params("processor", "uuid", "uuid.fieldName", "id_s"));
+
+ assertNotNull(d);
+
+ assertEquals("550e8400-e29b-41d4-a716-446655440000",
+ d.getFieldValue("id_s"));
+ assertEquals(121, d.getFieldValue("processor_default_i"));
+ }
+
+ public void testProcessorPrefixReqParam() throws Exception {
+ List<UpdateRequestProcessorFactory> processors = UpdateRequestProcessorChain.getReqProcessors("uuid", h.getCore());
+ UpdateRequestProcessorFactory processorFactory = processors.get(0);
+ assertTrue(processorFactory instanceof UUIDUpdateProcessorFactory);
- /**
+ SolrQueryResponse rsp = new SolrQueryResponse();
+ SolrQueryRequest req = new LocalSolrQueryRequest(h.getCore(), new ModifiableSolrParams());
+ AddUpdateCommand cmd = new AddUpdateCommand(req);
+ cmd.solrDoc = new SolrInputDocument();
+ cmd.solrDoc.addField("random_s", "random_val");
+
+ processorFactory.getInstance(req, rsp, null).processAdd(cmd);
+ assertNotNull(cmd.solrDoc);
+ assertNotNull(cmd.solrDoc.get("id"));
+ assertNotNull(cmd.solrDoc.get("id").getValue());
+ }
+
+ /**
* Convenience method for building up SolrInputDocuments
*/
SolrInputDocument doc(SolrInputField... fields) {
@@ -100,7 +147,7 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
return d;
}
- /**
+ /**
* Convenience method for building up SolrInputFields
*/
SolrInputField field(String name, float boost, Object... values) {
@@ -111,7 +158,7 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
return f;
}
- /**
+ /**
* Convenience method for building up SolrInputFields with default boost
*/
SolrInputField f(String name, Object... values) {
@@ -120,22 +167,30 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {
/**
- * Runs a document through the specified chain, and returns the final
- * document used when the chain is completed (NOTE: some chains may
+ * Runs a document through the specified chain, and returns the final
+ * document used when the chain is completed (NOTE: some chains may
* modify the document in place
*/
- SolrInputDocument processAdd(final String chain,
- final SolrInputDocument docIn)
- throws IOException {
+
+ SolrInputDocument processAdd(final String chain,
+ final SolrInputDocument docIn) throws IOException {
+ return processAdd(chain, docIn, params());
+ }
+
+ SolrInputDocument processAdd(final String chain,
+ final SolrInputDocument docIn, SolrParams params)
+ throws IOException {
SolrCore core = h.getCore();
- UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain);
+ UpdateRequestProcessorChain pc = chain == null ?
+ core.getUpdateProcessorChain(params) :
+ core.getUpdateProcessingChain(chain);
assertNotNull("No Chain named: " + chain, pc);
SolrQueryResponse rsp = new SolrQueryResponse();
SolrQueryRequest req = new LocalSolrQueryRequest
- (core, new ModifiableSolrParams());
+ (core, params);
try {
SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req,rsp));
AddUpdateCommand cmd = new AddUpdateCommand(req);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/util/TestUtils.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/TestUtils.java b/solr/core/src/test/org/apache/solr/util/TestUtils.java
index 0423fbf..2f4cd53 100644
--- a/solr/core/src/test/org/apache/solr/util/TestUtils.java
+++ b/solr/core/src/test/org/apache/solr/util/TestUtils.java
@@ -183,12 +183,14 @@ public class TestUtils extends SolrTestCaseJ4 {
public void testBinaryCommands() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- new JavaBinCodec().marshal((MapWriter) ew -> {
- ew.put("set-user", fromJSONString("{x:y}"));
- ew.put("set-user", fromJSONString("{x:y,x1:y1}"));
- ew.put("single", Arrays.asList(fromJSONString("[{x:y,x1:y1},{x2:y2}]"), fromJSONString( "{x2:y2}")));
- ew.put("multi", Arrays.asList(fromJSONString("{x:y,x1:y1}"), fromJSONString( "{x2:y2}")));
- }, baos);
+ try (final JavaBinCodec jbc = new JavaBinCodec()) {
+ jbc.marshal((MapWriter) ew -> {
+ ew.put("set-user", fromJSONString("{x:y}"));
+ ew.put("set-user", fromJSONString("{x:y,x1:y1}"));
+ ew.put("single", Arrays.asList(fromJSONString("[{x:y,x1:y1},{x2:y2}]"), fromJSONString( "{x2:y2}")));
+ ew.put("multi", Arrays.asList(fromJSONString("{x:y,x1:y1}"), fromJSONString( "{x2:y2}")));
+ }, baos);
+ }
ContentStream stream = new ContentStreamBase.ByteArrayStream(baos.toByteArray(),null, "application/javabin");
List<CommandOperation> commands = CommandOperation.readCommands(Collections.singletonList(stream), new NamedList(), Collections.singleton("single"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/util/hll/BitVectorTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/hll/BitVectorTest.java b/solr/core/src/test/org/apache/solr/util/hll/BitVectorTest.java
index 0107af1..c84d817 100644
--- a/solr/core/src/test/org/apache/solr/util/hll/BitVectorTest.java
+++ b/solr/core/src/test/org/apache/solr/util/hll/BitVectorTest.java
@@ -19,6 +19,7 @@ package org.apache.solr.util.hll;
import java.util.Locale;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.util.LongIterator;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/util/hll/FullHLLTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/util/hll/FullHLLTest.java b/solr/core/src/test/org/apache/solr/util/hll/FullHLLTest.java
index aef4838..6be2656 100644
--- a/solr/core/src/test/org/apache/solr/util/hll/FullHLLTest.java
+++ b/solr/core/src/test/org/apache/solr/util/hll/FullHLLTest.java
@@ -17,6 +17,7 @@
package org.apache.solr.util.hll;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.util.LongIterator;
import org.junit.Test;
/**
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/example/example-DIH/README.txt
----------------------------------------------------------------------
diff --git a/solr/example/example-DIH/README.txt b/solr/example/example-DIH/README.txt
index ea8d28f..30c37eb 100644
--- a/solr/example/example-DIH/README.txt
+++ b/solr/example/example-DIH/README.txt
@@ -46,4 +46,4 @@ When Solr is started connect to:
http://localhost:8983/solr/tika/dataimport?command=full-import
Check also the Solr Reference Guide for detailed usage guide:
-https://cwiki.apache.org/confluence/display/solr/Uploading+Structured+Data+Store+Data+with+the+Data+Import+Handler
+https://lucene.apache.org/solr/guide/uploading-structured-data-store-data-with-the-data-import-handler.html
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/example/example-DIH/solr/atom/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/example/example-DIH/solr/atom/conf/solrconfig.xml b/solr/example/example-DIH/solr/atom/conf/solrconfig.xml
index 2b44ca6..5cf00d9 100644
--- a/solr/example/example-DIH/solr/atom/conf/solrconfig.xml
+++ b/solr/example/example-DIH/solr/atom/conf/solrconfig.xml
@@ -16,17 +16,17 @@
limitations under the License.
-->
-<!--
- This is a DEMO configuration, highlighting elements
+<!--
+ This is a DEMO configuration, highlighting elements
specifically needed to get this example running
such as libraries and request handler specifics.
It uses defaults or does not define most of production-level settings
such as various caches or auto-commit policies.
- See Solr Reference Guide and other examples for
+ See Solr Reference Guide and other examples for
more details on a well configured solrconfig.xml
- https://cwiki.apache.org/confluence/display/solr/The+Well-Configured+Solr+Instance
+ https://lucene.apache.org/solr/guide/the-well-configured-solr-instance.html
-->
<config>
@@ -44,6 +44,9 @@
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="df">text</str>
+ <!-- Change from JSON to XML format (the default prior to Solr 7.0)
+ <str name="wt">xml</str>
+ -->
</lst>
</requestHandler>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/example/example-DIH/solr/db/conf/managed-schema
----------------------------------------------------------------------
diff --git a/solr/example/example-DIH/solr/db/conf/managed-schema b/solr/example/example-DIH/solr/db/conf/managed-schema
index b96ff4c..df01bc0 100644
--- a/solr/example/example-DIH/solr/db/conf/managed-schema
+++ b/solr/example/example-DIH/solr/db/conf/managed-schema
@@ -65,21 +65,21 @@
-->
- <!-- Valid attributes for fields:
+ <!-- Valid attributes for fields:
name: mandatory - the name for the field
type: mandatory - the name of a field type from the
- fieldTypes
+ fieldTypes section
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable
docValues: true if this field should have doc values. Doc values are
- useful for faceting, grouping, sorting and function queries. Although not
- required, doc values will make the index faster to load, more
- NRT-friendly and more memory-efficient. They however come with some
- limitations: they are currently only supported by StrField, UUIDField
- and all Trie*Fields, and depending on the field type, they might
- require the field to be single-valued, be required or have a default
- value (check the documentation of the field type you're interested in
- for more information)
+ useful (required, if you are using *Point fields) for faceting,
+ grouping, sorting and function queries. Doc values will make the index
+ faster to load, more NRT-friendly and more memory-efficient.
+ They however come with some limitations: they are currently only
+ supported by StrField, UUIDField, all *PointFields, and depending
+ on the field type, they might require the field to be single-valued,
+ be required or have a default value (check the documentation
+ of the field type you're interested in for more information)
multiValued: true if this field may contain multiple values per document
omitNorms: (expert) set to true to omit the norms associated with
this field (this disables length normalization and index-time
@@ -98,7 +98,7 @@
value does not exist
default: a value that should be used if no value is specified
when adding a document.
- -->
+ -->
<!-- field names should consist of alphanumeric or underscore characters only and
not start with a digit. This is not currently strictly enforced,
@@ -110,7 +110,7 @@
<!-- If you remove this field, you must _also_ disable the update log in solrconfig.xml
or Solr won't start. _version_ and update log are required for SolrCloud
-->
- <field name="_version_" type="long" indexed="true" stored="true"/>
+ <field name="_version_" type="plong" indexed="true" stored="true"/>
<!-- points to the root document of a block of nested documents. Required for nested
document support, may be removed otherwise
@@ -130,9 +130,9 @@
<field name="features" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="includes" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
- <field name="weight" type="float" indexed="true" stored="true"/>
- <field name="price" type="float" indexed="true" stored="true"/>
- <field name="popularity" type="int" indexed="true" stored="true" />
+ <field name="weight" type="pfloat" indexed="true" stored="true"/>
+ <field name="price" type="pfloat" indexed="true" stored="true"/>
+ <field name="popularity" type="pint" indexed="true" stored="true" />
<field name="inStock" type="boolean" indexed="true" stored="true" />
<field name="store" type="location" indexed="true" stored="true"/>
@@ -155,7 +155,7 @@
<field name="resourcename" type="text_general" indexed="true" stored="true"/>
<field name="url" type="text_general" indexed="true" stored="true"/>
<field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
- <field name="last_modified" type="date" indexed="true" stored="true"/>
+ <field name="last_modified" type="pdate" indexed="true" stored="true"/>
<field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
<!-- Main body of document extracted by SolrCell.
@@ -183,7 +183,7 @@
<!--
Some fields such as popularity and manu_exact could be modified to
leverage doc values:
- <field name="popularity" type="int" indexed="true" stored="true" docValues="true" />
+ <field name="popularity" type="pint" indexed="true" stored="true" docValues="true" />
<field name="manu_exact" type="string" indexed="false" stored="false" docValues="true" />
<field name="cat" type="string" indexed="true" stored="true" docValues="true" multiValued="true"/>
@@ -194,43 +194,36 @@
-->
<!-- Dynamic field definitions allow using convention over configuration
- for fields via the specification of patterns to match field names.
+ for fields via the specification of patterns to match field names.
EXAMPLE: name="*_i" will match any field ending in _i (like myid_i, z_i)
RESTRICTION: the glob-like pattern in the name attribute must have
a "*" only at the start or the end. -->
- <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
- <dynamicField name="*_is" type="int" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_i" type="pint" indexed="true" stored="true"/>
+ <dynamicField name="*_is" type="pint" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_s" type="string" indexed="true" stored="true" />
<dynamicField name="*_s_ns" type="string" indexed="true" stored="false" />
<dynamicField name="*_ss" type="string" indexed="true" stored="true" multiValued="true"/>
- <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
- <dynamicField name="*_l_ns" type="long" indexed="true" stored="false"/>
- <dynamicField name="*_ls" type="long" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_l" type="plong" indexed="true" stored="true"/>
+ <dynamicField name="*_l_ns" type="plong" indexed="true" stored="false"/>
+ <dynamicField name="*_ls" type="plong" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_t" type="text_general" indexed="true" stored="true"/>
<dynamicField name="*_txt" type="text_general" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_en" type="text_en" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
<dynamicField name="*_bs" type="boolean" indexed="true" stored="true" multiValued="true"/>
- <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
- <dynamicField name="*_fs" type="float" indexed="true" stored="true" multiValued="true"/>
- <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
- <dynamicField name="*_ds" type="double" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_f" type="pfloat" indexed="true" stored="true"/>
+ <dynamicField name="*_fs" type="pfloat" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_d" type="pdouble" indexed="true" stored="true"/>
+ <dynamicField name="*_ds" type="pdouble" indexed="true" stored="true" multiValued="true"/>
<!-- Type used to index the lat and lon components for the "location" FieldType -->
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" />
- <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
- <dynamicField name="*_dts" type="date" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_dt" type="pdate" indexed="true" stored="true"/>
+ <dynamicField name="*_dts" type="pdate" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
- <!-- some trie-coded dynamic fields for faster range queries -->
- <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
- <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
- <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
- <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
- <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
-
<dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
<dynamicField name="ignored_*" type="ignored" multiValued="true"/>
@@ -310,8 +303,7 @@
<!-- sortMissingLast and sortMissingFirst attributes are optional attributes are
currently supported on types that are sorted internally as strings
and on numeric types.
- This includes "string","boolean", and, as of 3.5 (and 4.x),
- int, float, long, date, double, including the "Trie" variants.
+ This includes "string", "boolean", "pint", "pfloat", "plong", "pdate", "pdouble".
- If sortMissingLast="true", then a sort on this field will cause documents
without the field to come after documents with the field,
regardless of the requested sort order (asc or desc).
@@ -321,33 +313,21 @@
- If sortMissingLast="false" and sortMissingFirst="false" (the default),
then default lucene sorting will be used which places docs without the
field first in an ascending sort and last in a descending sort.
- -->
-
- <!--
- Default numeric field types. For faster range queries, consider the tint/tfloat/tlong/tdouble types.
-
- These fields support doc values, but they require the field to be
- single-valued and either be required or have a default value.
-->
- <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
- <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
- <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
- <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
<!--
- Numeric field types that index each value at various levels of precision
- to accelerate range queries when the number of values between the range
- endpoints is large. See the javadoc for NumericRangeQuery for internal
- implementation details.
-
- Smaller precisionStep values (specified in bits) will lead to more tokens
- indexed per value, slightly larger index size, and faster range queries.
- A precisionStep of 0 disables indexing at different precision levels.
+ Numeric field types that index values using KD-trees.
+ Point fields don't support FieldCache, so they must have docValues="true" if needed for sorting, faceting, functions, etc.
-->
- <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
- <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
- <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
- <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="pint" class="solr.IntPointField" docValues="true"/>
+ <fieldType name="pfloat" class="solr.FloatPointField" docValues="true"/>
+ <fieldType name="plong" class="solr.LongPointField" docValues="true"/>
+ <fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>
+
+ <fieldType name="pints" class="solr.IntPointField" docValues="true" multiValued="true"/>
+ <fieldType name="pfloats" class="solr.FloatPointField" docValues="true" multiValued="true"/>
+ <fieldType name="plongs" class="solr.LongPointField" docValues="true" multiValued="true"/>
+ <fieldType name="pdoubles" class="solr.DoublePointField" docValues="true" multiValued="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
@@ -367,16 +347,12 @@
... 6 months and 3 days in the future from the start of
the current day
- Consult the TrieDateField javadocs for more information.
-
- Note: For faster range queries, consider the tdate type
+ Consult the DatePointField javadocs for more information.
-->
- <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
-
- <!-- A Trie based date field for faster date range queries and date faceting. -->
- <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0"/>
-
-
+ <!-- KD-tree versions of date fields -->
+ <fieldType name="pdate" class="solr.DatePointField" docValues="true"/>
+ <fieldType name="pdates" class="solr.DatePointField" docValues="true" multiValued="true"/>
+
<!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
<fieldType name="binary" class="solr.BinaryField"/>