View Javadoc
1   /*
2    * Copyright 2012-2019 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.entity;
17  
18  import org.codelibs.fess.mylasta.direction.FessConfig;
19  import org.codelibs.fess.util.ComponentUtil;
20  
21  public class HighlightInfo {
22      private String type;
23      private int fragmentSize;
24      private int numOfFragments;
25  
26      public HighlightInfo() {
27          final FessConfig fessConfig = ComponentUtil.getFessConfig();
28          this.type = fessConfig.getQueryHighlightType();
29          this.fragmentSize = fessConfig.getQueryHighlightFragmentSizeAsInteger();
30          this.numOfFragments = fessConfig.getQueryHighlightNumberOfFragmentsAsInteger();
31      }
32  
33      public String getType() {
34          return type;
35      }
36  
37      public HighlightInfo type(final String type) {
38          this.type = type;
39          return this;
40      }
41  
42      public int getFragmentSize() {
43          return fragmentSize;
44      }
45  
46      public HighlightInfo fragmentSize(final int fragmentSize) {
47          this.fragmentSize = fragmentSize;
48          return this;
49      }
50  
51      public int getNumOfFragments() {
52          return numOfFragments;
53      }
54  
55      public HighlightInfo numOfFragments(final int numOfFragments) {
56          this.numOfFragments = numOfFragments;
57          return this;
58      }
59  }