Skip to content

Apache Lucene open-source search software

SOLR-2724 Removed defaultSearchField and defaultOperator from schema.xml as they are deprecated.

David Wayne Smiley264f63036cbd
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index f14b91345e7..f7e12d8915c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -503,6 +503,10 @@ Upgrading from Solr 3.5
* SOLR-3161: Don't use the 'qt' parameter with a leading '/'. It probably won't work in 4.0
and it's now limited in 3.6 to SearchHandler subclasses that aren't lazy-loaded.
+* SOLR-2724: Specifying <defaultSearchField> and <solrQueryParser defaultOperator="..."/> in
+ schema.xml is now considered deprecated. Instead you are encouraged to specify these via the "df"
+ and "q.op" parameters in your request handler definition. (David Smiley)
+
New Features
----------------------
* SOLR-2854: Now load URL content stream data (via stream.url) when called for during request handling,
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 7cac8994e5b..2dd86610963 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -438,7 +438,7 @@ public final class IndexSchema {
node = (Node) xpath.evaluate("/schema/defaultSearchField/text()", document, XPathConstants.NODE);
if (node==null) {
- log.warn("no default search field specified in schema.");
+ log.debug("no default search field specified in schema.");
} else {
defaultSearchFieldName=node.getNodeValue().trim();
// throw exception if specified, but not found or not indexed
@@ -449,7 +449,7 @@ public final class IndexSchema {
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, msg );
}
}
- log.info("default search field is "+defaultSearchFieldName);
+ log.info("default search field in schema is "+defaultSearchFieldName);
}
node = (Node) xpath.evaluate("/schema/solrQueryParser/@defaultOperator", document, XPathConstants.NODE);
diff --git a/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java b/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java
index 630c6ada985..4b5899e71ec 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrQueryParser.java
@@ -133,7 +133,7 @@ public class SolrQueryParser extends QueryParser {
if (field == null && defaultField == null) {
throw new SolrException
(SolrException.ErrorCode.BAD_REQUEST,
- "no field name specified in query and no defaultSearchField defined in schema.xml");
+ "no field name specified in query and no default specified via 'df' param");
}
}
diff --git a/solr/example/solr/conf/schema.xml b/solr/example/solr/conf/schema.xml
index abc40e1a270..714a694b051 100755
--- a/solr/example/solr/conf/schema.xml
+++ b/solr/example/solr/conf/schema.xml
@@ -987,12 +987,6 @@
-->
<uniqueKey>id</uniqueKey>
- <!-- field for the QueryParser to use when an explicit fieldname is absent -->
- <defaultSearchField>text</defaultSearchField>
-
- <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
- <solrQueryParser defaultOperator="OR"/>
-
<!-- copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field differently,
or to add multiple fields to the same field for easier/faster searching. -->
diff --git a/solr/example/solr/conf/solrconfig.xml b/solr/example/solr/conf/solrconfig.xml
index c8ea9a385da..7678642e736 100755
--- a/solr/example/solr/conf/solrconfig.xml
+++ b/solr/example/solr/conf/solrconfig.xml
@@ -734,6 +734,7 @@
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
+ <str name="df">text</str>
</lst>
<!-- In addition to defaults, "appends" params can be specified
to identify values which should be appended to the list of