~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to solr/core/src/java/org/apache/solr/util/CommonParams.java

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
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
8
 
 *
9
 
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 
 *
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.
16
 
 */
17
 
 
18
 
package org.apache.solr.util;
19
 
 
20
 
import org.apache.solr.common.util.NamedList;
21
 
 
22
 
import org.slf4j.Logger;
23
 
import org.slf4j.LoggerFactory;
24
 
 
25
 
/**
26
 
 * A collection on common params, both for Plugin initialization and
27
 
 * for Requests.
28
 
 * @deprecated Use {@link org.apache.solr.common.params.CommonParams} instead.
29
 
 */
30
 
@Deprecated
31
 
public class CommonParams implements org.apache.solr.common.params.CommonParams {
32
 
 
33
 
  public static Logger log = LoggerFactory.getLogger(CommonParams.class);
34
 
  
35
 
 
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;
52
 
 
53
 
 
54
 
  public CommonParams() {
55
 
    /* :NOOP: */
56
 
  }
57
 
 
58
 
  /** @see #setValues */
59
 
  public CommonParams(NamedList args) {
60
 
    this();
61
 
    setValues(args);
62
 
  }
63
 
 
64
 
  /**
65
 
   * Sets the params using values from a NamedList, usefull in the
66
 
   * init method for your handler.
67
 
   *
68
 
   * <p>
69
 
   * If any param is not of the expected type, a severe error is
70
 
   * logged,and the param is skipped.
71
 
   * </p>
72
 
   *
73
 
   * <p>
74
 
   * If any param is not of in the NamedList, it is skipped and the
75
 
   * old value is left alone.
76
 
   * </p>
77
 
   *
78
 
   */
79
 
  public void setValues(NamedList args) {
80
 
 
81
 
    Object tmp;
82
 
 
83
 
    tmp = args.get(FL);
84
 
    if (null != tmp) {
85
 
      if (tmp instanceof String) {
86
 
        fl = tmp.toString();
87
 
      } else {
88
 
        log.error("init param is not a str: " + FL);
89
 
      }
90
 
    }
91
 
 
92
 
    tmp = args.get(DF);
93
 
    if (null != tmp) {
94
 
      if (tmp instanceof String) {
95
 
        df = tmp.toString();
96
 
      } else {
97
 
        log.error("init param is not a str: " + DF);
98
 
      }
99
 
    }
100
 
 
101
 
    tmp = args.get(DEBUG_QUERY);
102
 
    if (null != tmp) {
103
 
      if (tmp instanceof String) {
104
 
        debugQuery = tmp.toString();
105
 
      } else {
106
 
        log.error("init param is not a str: " + DEBUG_QUERY);
107
 
      }
108
 
    }
109
 
 
110
 
    tmp = args.get(EXPLAIN_OTHER);
111
 
    if (null != tmp) {
112
 
      if (tmp instanceof String) {
113
 
        explainOther = tmp.toString();
114
 
      } else {
115
 
        log.error("init param is not a str: " + EXPLAIN_OTHER);
116
 
      }
117
 
    }
118
 
 
119
 
  }
120
 
 
121
 
}
122