[
https://issues.apache.org/jira/browse/SOLR-2724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13822304#comment-13822304
]
Anca Kopetz commented on SOLR-2724:
-----------------------------------
Hi,
I do not know if my comment is useful, but I found some code that still uses
the defaultOperator from schema.xml in solr-core-4.5.1
{code:title=DisMaxQParser.java|borderStyle=solid}
public static String parseMinShouldMatch(final IndexSchema schema,
final SolrParams params) {
org.apache.solr.parser.QueryParser.Operator op =
QueryParsing.getQueryParserDefaultOperator
(schema, params.get(QueryParsing.OP));
return params.get(DisMaxParams.MM, op.equals(QueryParser.Operator.AND) ?
"100%" : "0%");
}
{code}
{code:title=QueryParsing.java|borderStyle=solid}
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;
}
{code}
> Deprecate defaultSearchField and defaultOperator defined in schema.xml
> ----------------------------------------------------------------------
>
> Key: SOLR-2724
> URL: https://issues.apache.org/jira/browse/SOLR-2724
> Project: Solr
> Issue Type: Improvement
> Components: Schema and Analysis, search
> Reporter: David Smiley
> Assignee: David Smiley
> Priority: Minor
> Fix For: 3.6, 4.0-ALPHA
>
> Attachments:
> SOLR-2724_deprecateDefaultSearchField_and_defaultOperator.patch,
> SOLR-2724_deprecateDefaultSearchField_and_defaultOperator.patch
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> I've always been surprised to see the <defaultSearchField> element and
> <solrQueryParser defaultOperator="OR"/> defined in the schema.xml file since
> the first time I saw them. They just seem out of place to me since they are
> more query parser related than schema related. But not only are they
> misplaced, I feel they shouldn't exist. For query parsers, we already have a
> "df" parameter that works just fine, and explicit field references. And the
> default lucene query operator should stay at OR -- if a particular query
> wants different behavior then use q.op or simply use "OR".
> <similarity> Seems like something better placed in solrconfig.xml than in the
> schema.
> In my opinion, defaultSearchField and defaultOperator configuration elements
> should be deprecated in Solr 3.x and removed in Solr 4. And <similarity>
> should move to solrconfig.xml. I am willing to do it, provided there is
> consensus on it of course.
--
This message was sent by Atlassian JIRA
(v6.1#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]