You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2017/05/15 13:00:13 UTC
lucene-solr:master: SOLR-10584: Remove defaultOperator completely in
7.0
Repository: lucene-solr
Updated Branches:
refs/heads/master 9dc952a47 -> 66cd20e98
SOLR-10584: Remove defaultOperator completely in 7.0
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/66cd20e9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/66cd20e9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/66cd20e9
Branch: refs/heads/master
Commit: 66cd20e98a611bd28ed642be518d34edc4da5d20
Parents: 9dc952a
Author: Jan Høydahl <ja...@apache.org>
Authored: Mon May 15 09:44:09 2017 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Mon May 15 09:44:09 2017 +0200
----------------------------------------------------------------------
solr/CHANGES.txt | 23 +++++++++------
.../org/apache/solr/handler/SchemaHandler.java | 10 -------
.../apache/solr/response/SchemaXmlWriter.java | 4 ---
.../org/apache/solr/schema/IndexSchema.java | 26 ++---------------
.../apache/solr/schema/ManagedIndexSchema.java | 2 --
.../solr/search/ComplexPhraseQParserPlugin.java | 2 +-
.../org/apache/solr/search/DisMaxQParser.java | 5 ++--
.../solr/search/ExtendedDismaxQParser.java | 3 +-
.../org/apache/solr/search/LuceneQParser.java | 4 +--
.../org/apache/solr/search/QueryParsing.java | 27 +++++++++++-------
.../apache/solr/search/SimpleQParserPlugin.java | 2 +-
.../src/resources/apispec/core.SchemaRead.json | 3 +-
.../conf/bad-schema-default-operator.xml | 26 +++++++++++++++++
...tSolrQueryParserDefaultOperatorResource.java | 29 -------------------
.../schema/TestSolrQueryParserResource.java | 30 --------------------
.../apache/solr/schema/BadIndexSchemaTest.java | 6 +++-
16 files changed, 72 insertions(+), 130 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f42d2ac..16c91af 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -70,6 +70,9 @@ Upgrading from Solr 6.x
query text will not be split on whitespace before analysis. See
https://lucidworks.com/2017/04/18/multi-word-synonyms-solr-adds-query-time-support/ .
+* Setting <solrQueryParser defaultOperator="..."/> in schema is no longer allowed and will cause an exception.
+ Please use "q.op" parameter on the request instead. For more details, see SOLR-10584.
+
New Features
----------------------
* SOLR-9857, SOLR-9858: Collect aggregated metrics from nodes and shard leaders in overseer. (ab)
@@ -102,7 +105,7 @@ Bug Fixes
* SOLR-10408: v2 API introspect should return useful message for non-existent command (Cao Manh Dat)
-* SOLR-10411: v2 Collection API "modify" command specification's replicationFactor property is incorrectly typed as string,
+* SOLR-10411: v2 Collection API "modify" command specification's replicationFactor property is incorrectly typed as string,
should be integer (Cao Manh Dat)
* SOLR-10405: v2 API introspect response contains multiple copies of the experimental format WARNING (Cao Manh Dat)
@@ -128,6 +131,7 @@ Optimizations
(yonik)
Other Changes
+----------------------
* SOLR-10236: Removed FieldType.getNumericType(). Use getNumberType() instead. (Tomás Fernández Löbbe)
* SOLR-10347: Removed index level boost support from "documents" section of the admin UI (Amrit Sarkar via
@@ -148,6 +152,9 @@ Other Changes
* SOLR-10647: Move the V1 <-> V2 API mapping to SolrJ (noble)
+* SOLR-10584: We'll now always throw an exception if defaultOperator is found in schema. This config has
+ been deprecated since 3.6, and enforced for new configs since 6.6 (janhoy)
+
================== 6.7.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
@@ -169,8 +176,8 @@ Other Changes
* SOLR-10617: JDBCStream accepts columns of type TIME, DATE & TIMESTAMP as well as CLOBs and decimal
numeric types (James Dyer)
-
-* SOLR-10400: Replace (instanceof TrieFooField || instanceof FooPointField) constructs with
+
+* SOLR-10400: Replace (instanceof TrieFooField || instanceof FooPointField) constructs with
FieldType.getNumberType() or SchemaField.getSortField() where appropriate. (hossman, Steve Rowe)
================== 6.6.0 ==================
@@ -361,9 +368,9 @@ Bug Fixes
* SOLR-10549: The new 'large' attribute had been forgotten in /schema/fieldtypes?showDefaults=true (David Smiley)
-* SOLR-10615: requests are suspended until SolrDispatchFilter initialization is completed.
- After core container shutdown or severe initialization problem Solr responds with
- http stauts 404 Not Found instead of 500 as it was before (Mikhail Khludnev)
+* SOLR-10615: requests are suspended until SolrDispatchFilter initialization is completed.
+ After core container shutdown or severe initialization problem Solr responds with
+ http stauts 404 Not Found instead of 500 as it was before (Mikhail Khludnev)
* SOLR-8149: Admin UI - Plugins / Stats - active item is now highlighted (Labuzov Dmitriy via janhoy)
@@ -438,9 +445,9 @@ Other Changes
* SOLR-10601: StreamExpressionParser should handle white space around = in named parameters (Joel Bernstein)
-* SOLR-10614: Static fields have turned to instance's field in SimplePostTool.
+* SOLR-10614: Static fields have turned to instance's field in SimplePostTool.
Enabled TestSolrCLIRunExample.testTechproductsExample(). (Andrey Kudryavtsev, Mikhail Khludnev)
-
+
* SOLR-10522: Revert SpellCheckComponent response format change from SOLR-9972 (rel. 6.5.0). While this
was an improvement for the json "arrntv" format, it caused problems for the default json format.
(James Dyer, reported by Nikita Pchelintsev)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/handler/SchemaHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/SchemaHandler.java b/solr/core/src/java/org/apache/solr/handler/SchemaHandler.java
index f3e503e..38f29a7 100644
--- a/solr/core/src/java/org/apache/solr/handler/SchemaHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/SchemaHandler.java
@@ -146,12 +146,6 @@ public class SchemaHandler extends RequestHandlerBase implements SolrCoreAware,
rsp.add(IndexSchema.DEFAULT_SEARCH_FIELD, defaultSearchFieldName);
break;
}
- case "/schema/solrqueryparser": {
- SimpleOrderedMap<Object> props = new SimpleOrderedMap<>();
- props.add(IndexSchema.DEFAULT_OPERATOR, req.getSchema().getQueryParserDefaultOperator());
- rsp.add(IndexSchema.SOLR_QUERY_PARSER, props);
- break;
- }
case "/schema/zkversion": {
int refreshIfBelowVersion = -1;
Object refreshParam = req.getParams().get("refreshIfBelowVersion");
@@ -175,10 +169,6 @@ public class SchemaHandler extends RequestHandlerBase implements SolrCoreAware,
rsp.add("zkversion", zkVersion);
break;
}
- case "/schema/solrqueryparser/defaultoperator": {
- rsp.add(IndexSchema.DEFAULT_OPERATOR, req.getSchema().getQueryParserDefaultOperator());
- break;
- }
default: {
List<String> parts = StrUtils.splitSmart(path, '/');
if (parts.get(0).isEmpty()) parts.remove(0);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java
index a38fe36..5801575 100644
--- a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java
@@ -103,10 +103,6 @@ public class SchemaXmlWriter extends TextResponseWriter {
closeStartTag(false);
writer.write(val.toString());
endTag(IndexSchema.DEFAULT_SEARCH_FIELD, false);
- } else if (schemaPropName.equals(IndexSchema.SOLR_QUERY_PARSER)) {
- openStartTag(IndexSchema.SOLR_QUERY_PARSER);
- writeAttr(IndexSchema.DEFAULT_OPERATOR, ((Map<String ,Object>) val).get(IndexSchema.DEFAULT_OPERATOR).toString());
- closeStartTag(true);
} else if (schemaPropName.equals(IndexSchema.SIMILARITY)) {
writeSimilarity((SimpleOrderedMap<Object>) val);
} else if (schemaPropName.equals(IndexSchema.FIELD_TYPES)) {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index 2ea63d4..9a69ec5 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -94,7 +94,6 @@ import static java.util.Collections.singletonMap;
public class IndexSchema {
public static final String COPY_FIELD = "copyField";
public static final String COPY_FIELDS = COPY_FIELD + "s";
- public static final String DEFAULT_OPERATOR = "defaultOperator";
public static final String DEFAULT_SCHEMA_FILE = "schema.xml";
public static final String DEFAULT_SEARCH_FIELD = "defaultSearchField";
public static final String DESTINATION = "dest";
@@ -112,7 +111,6 @@ public class IndexSchema {
public static final String SCHEMA = "schema";
public static final String SIMILARITY = "similarity";
public static final String SLASH = "/";
- public static final String SOLR_QUERY_PARSER = "solrQueryParser";
public static final String SOURCE = "source";
public static final String TYPE = "type";
public static final String TYPES = "types";
@@ -148,9 +146,6 @@ public class IndexSchema {
protected List<SchemaAware> schemaAware = new ArrayList<>();
protected String defaultSearchFieldName=null;
- protected String queryParserDefaultOperator = "OR";
- protected boolean isExplicitQueryParserDefaultOperator = false;
-
protected Map<String, List<CopyField>> copyFieldsMap = new HashMap<>();
public Map<String,List<CopyField>> getCopyFieldsMap() { return Collections.unmodifiableMap(copyFieldsMap); }
@@ -312,13 +307,6 @@ public class IndexSchema {
return defaultSearchFieldName;
}
- /**
- * default operator ("AND" or "OR") for QueryParser
- */
- public String getQueryParserDefaultOperator() {
- return queryParserDefaultOperator;
- }
-
protected SchemaField uniqueKeyField;
/**
@@ -540,15 +528,10 @@ public class IndexSchema {
}
// /schema/solrQueryParser/@defaultOperator
- expression = stepsToPath(SCHEMA, SOLR_QUERY_PARSER, AT + DEFAULT_OPERATOR);
+ expression = stepsToPath(SCHEMA, "solrQueryParser", AT + "defaultOperator");
node = (Node) xpath.evaluate(expression, document, XPathConstants.NODE);
- if (node==null) {
- log.debug("Default query parser operator not set in Schema");
- } else {
- isExplicitQueryParserDefaultOperator = true;
- queryParserDefaultOperator=node.getNodeValue().trim();
- log.warn("[{}] query parser default operator is {}. WARNING: Deprecated, please use 'q.op' on request instead.",
- coreName, queryParserDefaultOperator);
+ if (node != null) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Setting default operator in schema (solrQueryParser/@defaultOperator) not supported");
}
// /schema/uniqueKey/text()
@@ -1402,9 +1385,6 @@ public class IndexSchema {
VERSION(IndexSchema.VERSION, sp -> sp.schema.getVersion()),
UNIQUE_KEY(IndexSchema.UNIQUE_KEY, sp -> sp.schema.uniqueKeyFieldName),
DEFAULT_SEARCH_FIELD(IndexSchema.DEFAULT_SEARCH_FIELD, sp -> sp.schema.defaultSearchFieldName),
- SOLR_QUERY_PARSER(IndexSchema.SOLR_QUERY_PARSER, sp -> sp.schema.isExplicitQueryParserDefaultOperator ?
- singletonMap(DEFAULT_OPERATOR, sp.schema.queryParserDefaultOperator) :
- null),
SIMILARITY(IndexSchema.SIMILARITY, sp -> sp.schema.isExplicitSimilarity ?
sp.schema.similarityFactory.getNamedPropertyValues() :
null),
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
index 9bc888d..de292fd 100644
--- a/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchema.java
@@ -1358,8 +1358,6 @@ public final class ManagedIndexSchema extends IndexSchema {
newSchema.name = name;
newSchema.version = version;
newSchema.defaultSearchFieldName = defaultSearchFieldName;
- newSchema.queryParserDefaultOperator = queryParserDefaultOperator;
- newSchema.isExplicitQueryParserDefaultOperator = isExplicitQueryParserDefaultOperator;
newSchema.similarity = similarity;
newSchema.similarityFactory = similarityFactory;
newSchema.isExplicitSimilarity = isExplicitSimilarity;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/ComplexPhraseQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ComplexPhraseQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/ComplexPhraseQParserPlugin.java
index 2a00a09..1ce7aed 100644
--- a/solr/core/src/java/org/apache/solr/search/ComplexPhraseQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/ComplexPhraseQParserPlugin.java
@@ -156,7 +156,7 @@ public class ComplexPhraseQParserPlugin extends QParserPlugin {
lparser.setInOrder(inOrder);
- QueryParser.Operator defaultOperator = QueryParsing.getQueryParserDefaultOperator(getReq().getSchema(), getParam(QueryParsing.OP));
+ QueryParser.Operator defaultOperator = QueryParsing.parseOP(getParam(QueryParsing.OP));
if (QueryParser.Operator.AND.equals(defaultOperator))
lparser.setDefaultOperator(org.apache.lucene.queryparser.classic.QueryParser.Operator.AND);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/DisMaxQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/DisMaxQParser.java b/solr/core/src/java/org/apache/solr/search/DisMaxQParser.java
index efd1c20..28c80b0 100644
--- a/solr/core/src/java/org/apache/solr/search/DisMaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/DisMaxQParser.java
@@ -52,14 +52,13 @@ public class DisMaxQParser extends QParser {
* Applies the appropriate default rules for the "mm" param based on the
* effective value of the "q.op" param
*
- * @see QueryParsing#getQueryParserDefaultOperator
* @see QueryParsing#OP
* @see DisMaxParams#MM
*/
public static String parseMinShouldMatch(final IndexSchema schema,
final SolrParams params) {
- org.apache.solr.parser.QueryParser.Operator op = QueryParsing.getQueryParserDefaultOperator
- (schema, params.get(QueryParsing.OP));
+ org.apache.solr.parser.QueryParser.Operator op = QueryParsing.parseOP(params.get(QueryParsing.OP));
+
return params.get(DisMaxParams.MM,
op.equals(QueryParser.Operator.AND) ? "100%" : "0%");
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
index 937f77e..a68836c 100644
--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
@@ -990,8 +990,7 @@ public class ExtendedDismaxQParser extends QParser {
super(parser, defaultField);
// Respect the q.op parameter before mm will be applied later
SolrParams defaultParams = SolrParams.wrapDefaults(parser.getLocalParams(), parser.getParams());
- QueryParser.Operator defaultOp = QueryParsing.getQueryParserDefaultOperator(
- parser.getReq().getSchema(), defaultParams.get(QueryParsing.OP));
+ QueryParser.Operator defaultOp = QueryParsing.parseOP(defaultParams.get(QueryParsing.OP));
setDefaultOperator(defaultOp);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/LuceneQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/LuceneQParser.java b/solr/core/src/java/org/apache/solr/search/LuceneQParser.java
index 9668d8f..16b29d3 100644
--- a/solr/core/src/java/org/apache/solr/search/LuceneQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/LuceneQParser.java
@@ -44,9 +44,7 @@ public class LuceneQParser extends QParser {
}
lparser = new SolrQueryParser(this, defaultField);
- lparser.setDefaultOperator
- (QueryParsing.getQueryParserDefaultOperator(getReq().getSchema(),
- getParam(QueryParsing.OP)));
+ lparser.setDefaultOperator(QueryParsing.parseOP(getParam(QueryParsing.OP)));
lparser.setSplitOnWhitespace(StrUtils.parseBool
(getParam(QueryParsing.SPLIT_ON_WHITESPACE), SolrQueryParser.DEFAULT_SPLIT_ON_WHITESPACE));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/QueryParsing.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/QueryParsing.java b/solr/core/src/java/org/apache/solr/search/QueryParsing.java
index da16d86..4398ac4 100644
--- a/solr/core/src/java/org/apache/solr/search/QueryParsing.java
+++ b/solr/core/src/java/org/apache/solr/search/QueryParsing.java
@@ -59,18 +59,15 @@ public class QueryParsing {
/**
- * Returns the "preferred" default operator for use by Query Parsers,
- * based on the settings in the IndexSchema which may be overridden using
- * an optional String override value.
- *
- * @see IndexSchema#getQueryParserDefaultOperator()
- * @see #OP
+ * Returns the default operator for use by Query Parsers, parsed from the df string
+ * @param notUsed is not used, but is there for back compat with 3rd party QParsers
+ * @param df the df string from request
+ * @deprecated this method is here purely not to break code back compat in 7.x
*/
- public static QueryParser.Operator getQueryParserDefaultOperator(final IndexSchema sch,
- final String override) {
- String val = override;
- if (null == val) val = sch.getQueryParserDefaultOperator();
- return "AND".equals(val) ? QueryParser.Operator.AND : QueryParser.Operator.OR;
+ @Deprecated
+ public static QueryParser.Operator getQueryParserDefaultOperator(final IndexSchema notUsed,
+ final String df) {
+ return parseOP(df);
}
/**
@@ -396,4 +393,12 @@ public class QueryParsing {
return out;
}
+ /**
+ * Parses default operator string into Operator object
+ * @param operator the string from request
+ * @return Operator.AND if string equals "AND", else return Operator.OR (default)
+ */
+ public static QueryParser.Operator parseOP(String operator) {
+ return "and".equalsIgnoreCase(operator) ? QueryParser.Operator.AND : QueryParser.Operator.OR;
+ }
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/java/org/apache/solr/search/SimpleQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/SimpleQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/SimpleQParserPlugin.java
index 2b0098f..f265d93 100644
--- a/solr/core/src/java/org/apache/solr/search/SimpleQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/SimpleQParserPlugin.java
@@ -154,7 +154,7 @@ public class SimpleQParserPlugin extends QParserPlugin {
parser = new SolrSimpleQueryParser(req.getSchema().getQueryAnalyzer(), queryFields, enabledOps, this, schema);
// Set the default operator to be either 'AND' or 'OR' for the query.
- QueryParser.Operator defaultOp = QueryParsing.getQueryParserDefaultOperator(req.getSchema(), defaultParams.get(QueryParsing.OP));
+ QueryParser.Operator defaultOp = QueryParsing.parseOP(defaultParams.get(QueryParsing.OP));
if (defaultOp == QueryParser.Operator.AND) {
parser.setDefaultOperator(BooleanClause.Occur.MUST);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/resources/apispec/core.SchemaRead.json
----------------------------------------------------------------------
diff --git a/solr/core/src/resources/apispec/core.SchemaRead.json b/solr/core/src/resources/apispec/core.SchemaRead.json
index da62c06..c907954 100644
--- a/solr/core/src/resources/apispec/core.SchemaRead.json
+++ b/solr/core/src/resources/apispec/core.SchemaRead.json
@@ -11,8 +11,7 @@
"/schema/version",
"/schema/similarity",
"/schema/solrqueryparser",
- "/schema/zkversion",
- "/schema/solrqueryparser/defaultoperator"
+ "/schema/zkversion"
]
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/test-files/solr/collection1/conf/bad-schema-default-operator.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-default-operator.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-default-operator.xml
new file mode 100644
index 0000000..3de607c
--- /dev/null
+++ b/solr/core/src/test-files/solr/collection1/conf/bad-schema-default-operator.xml
@@ -0,0 +1,26 @@
+<?xml version="1.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.
+-->
+
+<schema name="bad-schema-default-operator" version="1.6">
+ <fieldType name="string" class="solr.StrField"/>
+ <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
+ <uniqueKey>id</uniqueKey>
+ <!-- BEGIN BAD STUFF: not allowed anymore -->
+ <solrQueryParser defaultOperator="OR"/>
+ <!-- END BAD STUFF -->
+</schema>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserDefaultOperatorResource.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserDefaultOperatorResource.java b/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserDefaultOperatorResource.java
deleted file mode 100644
index 064c3ac..0000000
--- a/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserDefaultOperatorResource.java
+++ /dev/null
@@ -1,29 +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.rest.schema;
-import org.apache.solr.rest.SolrRestletTestBase;
-import org.junit.Test;
-
-public class TestSolrQueryParserDefaultOperatorResource extends SolrRestletTestBase {
-
- @Test
- public void testGetDefaultOperator() throws Exception {
- assertQ("/schema/solrqueryparser/defaultoperator?indent=on&wt=xml",
- "count(/response/str[@name='defaultOperator']) = 1",
- "/response/str[@name='defaultOperator'][.='OR']");
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserResource.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserResource.java b/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserResource.java
deleted file mode 100644
index d4946ad..0000000
--- a/solr/core/src/test/org/apache/solr/rest/schema/TestSolrQueryParserResource.java
+++ /dev/null
@@ -1,30 +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.rest.schema;
-import org.apache.solr.rest.SolrRestletTestBase;
-import org.junit.Test;
-
-public class TestSolrQueryParserResource extends SolrRestletTestBase {
-
- @Test
- public void testGetSolrQueryParser() throws Exception {
- assertQ("/schema/solrqueryparser?indent=on&wt=xml",
- "count(/response/lst[@name='solrQueryParser']) = 1",
- "count(/response/lst[@name='solrQueryParser']/str[@name='defaultOperator']) = 1",
- "/response/lst[@name='solrQueryParser']/str[@name='defaultOperator'][.='OR']");
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/66cd20e9/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
index 8d2f93a..e24386b 100644
--- a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
@@ -127,5 +127,9 @@ public class BadIndexSchemaTest extends AbstractBadConfigTestBase {
doTest("bad-schema-sim-default-does-not-exist.xml",
"ft-does-not-exist");
}
-
+
+ public void testDefaultOperatorBanned() throws Exception {
+ doTest("bad-schema-default-operator.xml",
+ "default operator in schema (solrQueryParser/@defaultOperator) not supported");
+ }
}