2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
18
package org.apache.solr.util;
20
import org.apache.solr.common.util.NamedList;
22
import org.slf4j.Logger;
23
import org.slf4j.LoggerFactory;
26
* A collection on common params, both for Plugin initialization and
28
* @deprecated Use {@link org.apache.solr.common.params.CommonParams} instead.
31
public class CommonParams implements org.apache.solr.common.params.CommonParams {
33
public static Logger log = LoggerFactory.getLogger(CommonParams.class);
36
/** the default field list to be used */
37
public String fl = null;
38
/** the default field to query */
39
public String df = null;
40
/** do not debug by default **/
41
public String debugQuery = null;
42
/** no default other explanation query **/
43
public String explainOther = null;
44
/** whether to highlight */
45
public boolean highlight = false;
46
/** fields to highlight */
47
public String highlightFields = null;
48
/** maximum highlight fragments to return */
49
public int maxSnippets = 1;
50
/** override default highlight Formatter class */
51
public String highlightFormatterClass = null;
54
public CommonParams() {
58
/** @see #setValues */
59
public CommonParams(NamedList args) {
65
* Sets the params using values from a NamedList, usefull in the
66
* init method for your handler.
69
* If any param is not of the expected type, a severe error is
70
* logged,and the param is skipped.
74
* If any param is not of in the NamedList, it is skipped and the
75
* old value is left alone.
79
public void setValues(NamedList args) {
85
if (tmp instanceof String) {
88
log.error("init param is not a str: " + FL);
94
if (tmp instanceof String) {
97
log.error("init param is not a str: " + DF);
101
tmp = args.get(DEBUG_QUERY);
103
if (tmp instanceof String) {
104
debugQuery = tmp.toString();
106
log.error("init param is not a str: " + DEBUG_QUERY);
110
tmp = args.get(EXPLAIN_OTHER);
112
if (tmp instanceof String) {
113
explainOther = tmp.toString();
115
log.error("init param is not a str: " + EXPLAIN_OTHER);