You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2017/07/25 09:05:56 UTC
[11/50] [abbrv] lucene-solr:feature/autoscaling: SOLR-11114:
Randomize PointFields in schema-customfield.xml and
TestOverriddenPrefixQueryForCustomFieldType
SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c23cecc5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c23cecc5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c23cecc5
Branch: refs/heads/feature/autoscaling
Commit: c23cecc557b340596832c354df54a0ecf365db9e
Parents: 63acac6
Author: Chris Hostetter <ho...@apache.org>
Authored: Tue Jul 18 15:47:31 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Tue Jul 18 15:47:31 2017 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 1 +
.../collection1/conf/schema-customfield.xml | 4 +--
...IntPointPrefixActsAsRangeQueryFieldType.java | 34 ++++++++++++++++++++
.../TrieIntPrefixActsAsRangeQueryFieldType.java | 2 ++
...OverriddenPrefixQueryForCustomFieldType.java | 4 +++
5 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c23cecc5/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index cd6e1c5..7701176 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -517,6 +517,7 @@ Other Changes
- SOLR-11118: Randomize PointFields in schema-HighlighterMaxOffsetTest.xml, schema-luceneMatchVersion.xml,
schema-minimal-atomic-stress.xml, and all affected tests (Steve Rowe)
- SOLR-11113: Randomize PointFields in analysis-err-schema.xml, schema-hash.xml, and all affected tests (hossman)
+ - SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType (hossman)
* SOLR-6807: Changed requestDispatcher's handleSelect to default to false, thus ignoring "qt".
Simplified configs to not refer to handleSelect or "qt". Switch all tests that assumed true to assume false
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c23cecc5/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml b/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml
index cfb147a..44cea63 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-customfield.xml
@@ -39,12 +39,12 @@
</analyzer>
</fieldType>
- <fieldType name="customtrieintfield" class="org.apache.solr.schema.TrieIntPrefixActsAsRangeQueryFieldType"/>
+ <fieldType name="customintfield" class="${solr.tests.CustomIntFieldType}" docValues="${solr.tests.numeric.dv}" />
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
<field name="intfield" type="int" indexed="true" stored="true"/>
<field name="swap_foo_bar_in_prefix_query" type="customfield" indexed="true" stored="true" multiValued="true"/>
- <field name="int_prefix_as_range" type="customtrieintfield" indexed="true" stored="true"/>
+ <field name="int_prefix_as_range" type="customintfield" indexed="true" stored="true"/>
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c23cecc5/solr/core/src/test/org/apache/solr/schema/IntPointPrefixActsAsRangeQueryFieldType.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/IntPointPrefixActsAsRangeQueryFieldType.java b/solr/core/src/test/org/apache/solr/schema/IntPointPrefixActsAsRangeQueryFieldType.java
new file mode 100644
index 0000000..e9acdee
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/schema/IntPointPrefixActsAsRangeQueryFieldType.java
@@ -0,0 +1,34 @@
+/*
+ * 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.Query;
+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 TrieIntPrefixActsAsRangeQueryFieldType
+ */
+public class IntPointPrefixActsAsRangeQueryFieldType extends IntPointField {
+
+ public Query getPrefixQuery(QParser parser, SchemaField sf, String termStr) {
+ return getRangeQuery(parser, sf, termStr, Integer.MAX_VALUE + "", true, false);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c23cecc5/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/c23cecc5/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");
}