diff --git a/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java b/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java index a5e31b14a96..8a1997faf70 100644 --- a/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java +++ b/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java @@ -143,7 +143,7 @@ public class FieldAnalysisRequestHandler extends AnalysisRequestHandlerBase { useDefaultSearchField = false; } if (useDefaultSearchField) { - analysisRequest.addFieldName(req.getSchema().getSolrQueryParser(null).getField()); + analysisRequest.addFieldName(req.getSchema().getDefaultSearchFieldName()); } analysisRequest.setQuery(solrParams.get(AnalysisParams.QUERY, solrParams.get(CommonParams.Q))); analysisRequest.setFieldValue(solrParams.get(AnalysisParams.FIELD_VALUE)); diff --git a/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java b/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java index 6fdd2baf0a2..4102fccd243 100644 --- a/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java +++ b/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java @@ -371,7 +371,7 @@ public class LukeRequestHandler extends RequestHandlerBase finfo.add("fields", fields); finfo.add("dynamicFields", dynamicFields); finfo.add("uniqueKeyField", uniqueField.getName()); - finfo.add("defaultSearchField", schema.getSolrQueryParser(null).getField()); + finfo.add("defaultSearchField", schema.getDefaultSearchFieldName()); finfo.add("types", types); return finfo; } diff --git a/src/java/org/apache/solr/highlight/SolrHighlighter.java b/src/java/org/apache/solr/highlight/SolrHighlighter.java index 4235360c6af..f4fdf65aa08 100644 --- a/src/java/org/apache/solr/highlight/SolrHighlighter.java +++ b/src/java/org/apache/solr/highlight/SolrHighlighter.java @@ -73,7 +73,7 @@ public abstract class SolrHighlighter if(emptyArray(fields)) { // use default search field if highlight fieldlist not specified. if (emptyArray(defaultFields)) { - String defaultSearchField = request.getSchema().getSolrQueryParser(null).getField(); + String defaultSearchField = request.getSchema().getDefaultSearchFieldName(); fields = null == defaultSearchField ? new String[]{} : new String[]{defaultSearchField}; } else { diff --git a/src/java/org/apache/solr/schema/IndexSchema.java b/src/java/org/apache/solr/schema/IndexSchema.java index 13a6a5a9054..7b076dde173 100644 --- a/src/java/org/apache/solr/schema/IndexSchema.java +++ b/src/java/org/apache/solr/schema/IndexSchema.java @@ -251,6 +251,7 @@ public final class IndexSchema { * <solrQueryParser> configuration for this IndexSchema. * * @param defaultField if non-null overrides the schema default + * @deprecated */ public SolrQueryParser getSolrQueryParser(String defaultField) { SolrQueryParser qp = new SolrQueryParser(this,defaultField); @@ -262,9 +263,7 @@ public final class IndexSchema { /** * Name of the default search field specified in the schema file - * @deprecated use getSolrQueryParser().getField() */ - @Deprecated public String getDefaultSearchFieldName() { return defaultSearchFieldName; } diff --git a/src/java/org/apache/solr/search/DisMaxQParser.java b/src/java/org/apache/solr/search/DisMaxQParser.java index 67fa3b2533c..79b2516deb5 100644 --- a/src/java/org/apache/solr/search/DisMaxQParser.java +++ b/src/java/org/apache/solr/search/DisMaxQParser.java @@ -207,7 +207,7 @@ public class DisMaxQParser extends QParser { protected SolrPluginUtils.DisjunctionMaxQueryParser getParser(Map fields, String paramName, SolrParams solrParams, float tiebreaker) { int slop = solrParams.getInt(paramName, 0); - SolrPluginUtils.DisjunctionMaxQueryParser parser = new SolrPluginUtils.DisjunctionMaxQueryParser(req.getSchema(), + SolrPluginUtils.DisjunctionMaxQueryParser parser = new SolrPluginUtils.DisjunctionMaxQueryParser(this, IMPOSSIBLE_FIELD_NAME); parser.addAlias(IMPOSSIBLE_FIELD_NAME, tiebreaker, fields); parser.setPhraseSlop(slop); diff --git a/src/java/org/apache/solr/search/LuceneQParserPlugin.java b/src/java/org/apache/solr/search/LuceneQParserPlugin.java index 69879c44c6e..0d84f0ce34d 100755 --- a/src/java/org/apache/solr/search/LuceneQParserPlugin.java +++ b/src/java/org/apache/solr/search/LuceneQParserPlugin.java @@ -61,7 +61,7 @@ class LuceneQParser extends QParser { String defaultField = getParam(CommonParams.DF); if (defaultField==null) { - defaultField = getReq().getSchema().getSolrQueryParser(null).getField(); + defaultField = getReq().getSchema().getDefaultSearchFieldName(); } lparser = new SolrQueryParser(this, defaultField); diff --git a/src/java/org/apache/solr/search/SolrQueryParser.java b/src/java/org/apache/solr/search/SolrQueryParser.java index 48e120cb59e..2283b5f72bd 100644 --- a/src/java/org/apache/solr/search/SolrQueryParser.java +++ b/src/java/org/apache/solr/search/SolrQueryParser.java @@ -64,7 +64,7 @@ public class SolrQueryParser extends QueryParser { * * @param schema Used for default search field name if defaultField is null and field information is used for analysis * @param defaultField default field used for unspecified search terms. if null, the schema default field is used - * @see IndexSchema#getSolrQueryParser(String defaultField) + * @see IndexSchema#getDefaultSearchFieldName() */ public SolrQueryParser(IndexSchema schema, String defaultField) { super(defaultField == null ? schema.getDefaultSearchFieldName() : defaultField, schema.getQueryAnalyzer()); diff --git a/src/java/org/apache/solr/util/SolrPluginUtils.java b/src/java/org/apache/solr/util/SolrPluginUtils.java index 2c3a45a784e..32bc5980bb6 100644 --- a/src/java/org/apache/solr/util/SolrPluginUtils.java +++ b/src/java/org/apache/solr/util/SolrPluginUtils.java @@ -523,6 +523,7 @@ public class SolrPluginUtils { * NOTE: intra-function whitespace is not allowed. *

* @see #parseFieldBoosts + * @deprecated */ public static List parseFuncs(IndexSchema s, String in) throws ParseException { @@ -731,7 +732,11 @@ public class SolrPluginUtils { * DisjunctionMaxQuery and the tiebreaker to use. */ protected Map aliases = new HashMap(3); - + public DisjunctionMaxQueryParser(QParser qp, String defaultField) { + super(qp,defaultField); + // don't trust that our parent class won't ever change it's default + setDefaultOperator(QueryParser.Operator.OR); + } public DisjunctionMaxQueryParser(IndexSchema s, String defaultField) { super(s,defaultField); // don't trust that our parent class won't ever change it's default diff --git a/src/test/org/apache/solr/util/SolrPluginUtilsTest.java b/src/test/org/apache/solr/util/SolrPluginUtilsTest.java index 0098635e2b8..4bbc2fde48c 100644 --- a/src/test/org/apache/solr/util/SolrPluginUtilsTest.java +++ b/src/test/org/apache/solr/util/SolrPluginUtilsTest.java @@ -133,7 +133,7 @@ public class SolrPluginUtilsTest extends AbstractSolrTestCase { assertTrue(t+" sanity test isn't TermQuery: " + out.getClass(), out instanceof TermQuery); assertEquals(t+" sanity test is wrong field", - h.getCore().getSchema().getSolrQueryParser(null).getField(), + h.getCore().getSchema().getDefaultSearchFieldName(), ((TermQuery)out).getTerm().field()); t = "subject:XXXXXXXX";