View Javadoc
1   /*
2    * Copyright 2012-2020 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      private int fragmentOffset;
26  
27      public HighlightInfo() {
28          final FessConfig fessConfig = ComponentUtil.getFessConfig();
29          this.type = fessConfig.getQueryHighlightType();
30          this.fragmentSize = fessConfig.getQueryHighlightFragmentSizeAsInteger();
31          this.numOfFragments = fessConfig.getQueryHighlightNumberOfFragmentsAsInteger();
32          this.fragmentOffset = fessConfig.getQueryHighlightFragmentOffsetAsInteger();
33      }
34  
35      public String getType() {
36          return type;
37      }
38  
39      public HighlightInfo type(final String type) {
40          this.type = type;
41          return this;
42      }
43  
44      public int getFragmentSize() {
45          return fragmentSize;
46      }
47  
48      public HighlightInfo fragmentSize(final int fragmentSize) {
49          this.fragmentSize = fragmentSize;
50          return this;
51      }
52  
53      public int getNumOfFragments() {
54          return numOfFragments;
55      }
56  
57      public HighlightInfo numOfFragments(final int numOfFragments) {
58          this.numOfFragments = numOfFragments;
59          return this;
60      }
61  
62      public int getFragmentOffset() {
63          return fragmentOffset;
64      }
65  
66      public HighlightInfo fragmentOffset(final int fragmentOffset) {
67          this.fragmentOffset = fragmentOffset;
68          return this;
69      }
70  }