You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/07/18 22:52:37 UTC

[1/2] lucene-solr:branch_7x: SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7_0 2d5744c33 -> da941b189
  refs/heads/branch_7x 5588f1141 -> c05c7b53f


SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType

(cherry picked from commit c23cecc557b340596832c354df54a0ecf365db9e)


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

Branch: refs/heads/branch_7x
Commit: c05c7b53faf0469761a738a1c55ec0b37e59c367
Parents: 5588f11
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:48:44 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/c05c7b53/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 26abf71..776a9e3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -500,6 +500,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/c05c7b53/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/c05c7b53/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/c05c7b53/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/c05c7b53/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");
   }
 


[2/2] lucene-solr:branch_7_0: SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType

Posted by ho...@apache.org.
SOLR-11114: Randomize PointFields in schema-customfield.xml and TestOverriddenPrefixQueryForCustomFieldType

(cherry picked from commit c23cecc557b340596832c354df54a0ecf365db9e)


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

Branch: refs/heads/branch_7_0
Commit: da941b189bfc9f7319bba667acf2193162d40863
Parents: 2d5744c
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:51:16 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/da941b18/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 6f72171..c206c61 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -436,6 +436,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/da941b18/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/da941b18/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/da941b18/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/da941b18/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");
   }