View Javadoc
1   /*
2    * Copyright 2012-2025 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.crawler.util;
17  
18  import org.codelibs.fess.util.ComponentUtil;
19  
20  /**
21   * Fess-specific crawler configuration that extends OpenSearchCrawlerConfig.
22   * This class provides configuration settings for the Fess crawler including
23   * index names, shard counts, and replica counts for queue, data, and filter indices.
24   */
25  public class FessCrawlerConfig extends OpenSearchCrawlerConfig {
26  
27      /**
28       * Default constructor.
29       */
30      public FessCrawlerConfig() {
31          super();
32      }
33  
34      /**
35       * Gets the name of the queue index for the crawler.
36       *
37       * @return the queue index name
38       */
39      @Override
40      public String getQueueIndex() {
41          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerIndex() + ".queue";
42      }
43  
44      /**
45       * Gets the name of the data index for the crawler.
46       *
47       * @return the data index name
48       */
49      @Override
50      public String getDataIndex() {
51          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerIndex() + ".data";
52      }
53  
54      /**
55       * Gets the name of the filter index for the crawler.
56       *
57       * @return the filter index name
58       */
59      @Override
60      public String getFilterIndex() {
61          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerIndex() + ".filter";
62      }
63  
64      /**
65       * Gets the number of shards for the queue index.
66       *
67       * @return the number of queue shards
68       */
69      @Override
70      public int getQueueShards() {
71          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerQueueNumberOfShardsAsInteger();
72      }
73  
74      /**
75       * Gets the number of shards for the data index.
76       *
77       * @return the number of data shards
78       */
79      @Override
80      public int getDataShards() {
81          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerDataNumberOfShardsAsInteger();
82      }
83  
84      /**
85       * Gets the number of shards for the filter index.
86       *
87       * @return the number of filter shards
88       */
89      @Override
90      public int getFilterShards() {
91          return ComponentUtil.getFessConfig().getIndexDocumentCrawlerFilterNumberOfShardsAsInteger();
92      }
93  
94      /**
95       * Gets the number of replicas for the queue index.
96       *
97       * @return the number of queue replicas
98       */
99      @Override
100     public int getQueueReplicas() {
101         return ComponentUtil.getFessConfig().getIndexDocumentCrawlerQueueNumberOfReplicasAsInteger();
102     }
103 
104     /**
105      * Gets the number of replicas for the data index.
106      *
107      * @return the number of data replicas
108      */
109     @Override
110     public int getDataReplicas() {
111         return ComponentUtil.getFessConfig().getIndexDocumentCrawlerDataNumberOfReplicasAsInteger();
112     }
113 
114     /**
115      * Gets the number of replicas for the filter index.
116      *
117      * @return the number of filter replicas
118      */
119     @Override
120     public int getFilterReplicas() {
121         return ComponentUtil.getFessConfig().getIndexDocumentCrawlerFilterNumberOfReplicasAsInteger();
122     }
123 
124 }