code cleanup
This commit is contained in:
parent
fcbd587bac
commit
5b9959118e
41 changed files with 105 additions and 180 deletions
|
@ -114,12 +114,8 @@ public class FessBoot extends TomcatBoot {
|
|||
|
||||
protected static String getContextPath() {
|
||||
final String value = System.getProperty(FESS_CONTEXT_PATH);
|
||||
if (value != null) {
|
||||
if ("/".equals(value)) {
|
||||
return StringUtil.EMPTY;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
if (value != null && !"/".equals(value)) {
|
||||
return value;
|
||||
}
|
||||
return StringUtil.EMPTY;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -26,9 +27,7 @@ public class WebApiManagerFactory {
|
|||
|
||||
public void add(final WebApiManager webApiManager) {
|
||||
final List<WebApiManager> list = new ArrayList<>();
|
||||
for (final WebApiManager manager : webApiManagers) {
|
||||
list.add(manager);
|
||||
}
|
||||
Collections.addAll(list, webApiManagers);
|
||||
list.add(webApiManager);
|
||||
webApiManagers = list.toArray(new WebApiManager[list.size()]);
|
||||
}
|
||||
|
|
|
@ -127,40 +127,38 @@ public class ElevateWordService {
|
|||
op.setRefreshPolicy(Constants.TRUE);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Update
|
||||
if (labelTypeIds != null) {
|
||||
final List<ElevateWordToLabel> list = elevateWordToLabelBhv.selectList(wctltmCb -> {
|
||||
wctltmCb.query().setElevateWordId_Equal(elevateWordId);
|
||||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<ElevateWordToLabel> newList = new ArrayList<>();
|
||||
final List<ElevateWordToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final ElevateWordToLabel mapping : list) {
|
||||
if (mapping.getLabelTypeId().equals(id)) {
|
||||
exist = true;
|
||||
matchedList.add(mapping);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exist) {
|
||||
// new
|
||||
final ElevateWordToLabel mapping = new ElevateWordToLabel();
|
||||
mapping.setElevateWordId(elevateWordId);
|
||||
mapping.setLabelTypeId(id);
|
||||
newList.add(mapping);
|
||||
} else // Update
|
||||
if (labelTypeIds != null) {
|
||||
final List<ElevateWordToLabel> list = elevateWordToLabelBhv.selectList(wctltmCb -> {
|
||||
wctltmCb.query().setElevateWordId_Equal(elevateWordId);
|
||||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<ElevateWordToLabel> newList = new ArrayList<>();
|
||||
final List<ElevateWordToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final ElevateWordToLabel mapping : list) {
|
||||
if (mapping.getLabelTypeId().equals(id)) {
|
||||
exist = true;
|
||||
matchedList.add(mapping);
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.removeAll(matchedList);
|
||||
elevateWordToLabelBhv.batchInsert(newList, op -> {
|
||||
op.setRefreshPolicy(Constants.TRUE);
|
||||
});
|
||||
elevateWordToLabelBhv.batchDelete(list, op -> {
|
||||
op.setRefreshPolicy(Constants.TRUE);
|
||||
});
|
||||
if (!exist) {
|
||||
// new
|
||||
final ElevateWordToLabel mapping = new ElevateWordToLabel();
|
||||
mapping.setElevateWordId(elevateWordId);
|
||||
mapping.setLabelTypeId(id);
|
||||
newList.add(mapping);
|
||||
}
|
||||
}
|
||||
list.removeAll(matchedList);
|
||||
elevateWordToLabelBhv.batchInsert(newList, op -> {
|
||||
op.setRefreshPolicy(Constants.TRUE);
|
||||
});
|
||||
elevateWordToLabelBhv.batchDelete(list, op -> {
|
||||
op.setRefreshPolicy(Constants.TRUE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
+ StringEscapeUtils.escapeJson(hit.getId()) + "\"}}\n");
|
||||
writer.write(hit.getSourceAsString());
|
||||
writer.write("\n");
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -296,8 +296,8 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
private List<File> getAccessibleFileList(final File baseDir) {
|
||||
final List<File> fileList = new ArrayList<>();
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"), fessConfig.getSupportedUploadedMediaExtentionsAsArray(), true));
|
||||
final List<File> fileList = new ArrayList<>(
|
||||
FileUtils.listFiles(new File(baseDir, "images"), fessConfig.getSupportedUploadedMediaExtentionsAsArray(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"), fessConfig.getSupportedUploadedCssExtentionsAsArray(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"), fessConfig.getSupportedUploadedJsExtentionsAsArray(), true));
|
||||
return fileList;
|
||||
|
|
|
@ -353,9 +353,6 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
private static void validateStopwordsString(final String values, final String propertyName, final VaErrorHook hook) {
|
||||
if (values.length() == 0) {
|
||||
return;
|
||||
}
|
||||
// TODO validation
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ public class AdminMaintenanceAction extends FessAdminAction {
|
|||
+ "\"}}\n");
|
||||
writer.write(hit.getSourceAsString());
|
||||
writer.write("\n");
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
|
@ -309,10 +309,9 @@ public class AdminMaintenanceAction extends FessAdminAction {
|
|||
if (searchEngineClient.createIndex(docIndex, toIndex, numberOfShards, autoExpandReplicas, resetDictionaries)) {
|
||||
searchEngineClient.admin().cluster().prepareHealth(toIndex).setWaitForYellowStatus().execute(ActionListener.wrap(response -> {
|
||||
searchEngineClient.addMapping(docIndex, "doc", toIndex);
|
||||
if (searchEngineClient.reindex(fromIndex, toIndex, replaceAliases)) {
|
||||
if (replaceAliases && !searchEngineClient.updateAlias(toIndex)) {
|
||||
logger.warn("Failed to update aliases for {} and {}", fromIndex, toIndex);
|
||||
}
|
||||
if (searchEngineClient.reindex(fromIndex, toIndex, replaceAliases)
|
||||
&& (replaceAliases && !searchEngineClient.updateAlias(toIndex))) {
|
||||
logger.warn("Failed to update aliases for {} and {}", fromIndex, toIndex);
|
||||
}
|
||||
}, e -> logger.warn("Failed to reindex from {} to {}", fromIndex, toIndex, e)));
|
||||
return true;
|
||||
|
|
|
@ -147,7 +147,7 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
result.add(map);
|
||||
try {
|
||||
result.addAll(getAllAvailableArtifacts());
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
saveError(messages -> messages.addErrorsFailedToFindPlugins(GLOBAL));
|
||||
logger.warn("Failed to access a plugin repository.", e);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ApiResult {
|
|||
|
||||
private final int id;
|
||||
|
||||
private Status(final int id) {
|
||||
Status(final int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ApiAdminBackupAction extends FessApiAdminAction {
|
|||
+ StringEscapeUtils.escapeJson(hit.getId()) + "\"}}\n");
|
||||
writer.write(hit.getSourceAsString());
|
||||
writer.write("\n");
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.codelibs.fess.app.web.search;
|
|||
import static org.codelibs.core.stream.StreamUtil.stream;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -207,9 +208,7 @@ public class SearchAction extends FessSearchAction {
|
|||
final String[] values = form.fields.get(LABEL_FIELD);
|
||||
final List<String> labelList = new ArrayList<>();
|
||||
if (values != null) {
|
||||
for (final String v : values) {
|
||||
labelList.add(v);
|
||||
}
|
||||
Collections.addAll(labelList, values);
|
||||
}
|
||||
for (final String labelTypeValue : labelList) {
|
||||
for (final Map<String, String> map : labelTypeItems) {
|
||||
|
|
|
@ -180,7 +180,6 @@ public class CommandChain implements AuthenticationChain {
|
|||
private boolean teminated = false;
|
||||
|
||||
public MonitorThread(final Process process, final long timeout) {
|
||||
super();
|
||||
this.process = process;
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
@ -226,7 +225,6 @@ public class CommandChain implements AuthenticationChain {
|
|||
private final int maxLineBuffer;
|
||||
|
||||
public InputStreamThread(final InputStream is, final String charset, final int maxOutputLineBuffer) {
|
||||
super();
|
||||
try {
|
||||
br = new BufferedReader(new InputStreamReader(is, charset));
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
|
|
|
@ -245,12 +245,10 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
} else {
|
||||
putResultDataBody(dataMap, titleField, fessConfig.getCrawlerDocumentFileNoTitleLabel());
|
||||
}
|
||||
} else if (StringUtil.isBlank(fileName)) {
|
||||
putResultDataBody(dataMap, titleField, decodeUrlAsName(url, url.startsWith("file:")));
|
||||
} else {
|
||||
if (StringUtil.isBlank(fileName)) {
|
||||
putResultDataBody(dataMap, titleField, decodeUrlAsName(url, url.startsWith("file:")));
|
||||
} else {
|
||||
putResultDataBody(dataMap, titleField, fileName);
|
||||
}
|
||||
putResultDataBody(dataMap, titleField, fileName);
|
||||
}
|
||||
}
|
||||
// host
|
||||
|
|
|
@ -793,10 +793,8 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
logger.debug("Add Child: {}", u);
|
||||
}
|
||||
urlList.add(u);
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skip Child: {}", u);
|
||||
}
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skip Child: {}", u);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,13 +110,7 @@ public class KuromojiItem extends DictionaryItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (pos == null ? 0 : pos.hashCode());
|
||||
result = prime * result + (reading == null ? 0 : reading.hashCode());
|
||||
result = prime * result + (segmentation == null ? 0 : segmentation.hashCode());
|
||||
result = prime * result + (token == null ? 0 : token.hashCode());
|
||||
return result;
|
||||
return Objects.hash(pos, reading, segmentation, token);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.dict.mapping;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
|
@ -93,11 +94,7 @@ public class CharMappingItem extends DictionaryItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.hashCode(inputs);
|
||||
result = prime * result + (output == null ? 0 : output.hashCode());
|
||||
return result;
|
||||
return Objects.hash(Arrays.hashCode(inputs), output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,11 +75,7 @@ public class StemmerOverrideItem extends DictionaryItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((input == null) ? 0 : input.hashCode());
|
||||
result = prime * result + ((output == null) ? 0 : output.hashCode());
|
||||
return result;
|
||||
return Objects.hash(input, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.dict.synonym;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codelibs.core.collection.ArrayUtil;
|
||||
|
@ -91,11 +92,7 @@ public class SynonymItem extends DictionaryItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.hashCode(inputs);
|
||||
result = prime * result + Arrays.hashCode(outputs);
|
||||
return result;
|
||||
return Objects.hash(Arrays.hashCode(inputs), Arrays.hashCode(outputs));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,12 +129,10 @@ public class SynonymItem extends DictionaryItem {
|
|||
} else {
|
||||
return StringUtils.join(newInputs, ",") + "=>" + StringUtils.join(newOutputs, ",");
|
||||
}
|
||||
} else if (Arrays.equals(inputs, outputs)) {
|
||||
return StringUtils.join(inputs, ",");
|
||||
} else {
|
||||
if (Arrays.equals(inputs, outputs)) {
|
||||
return StringUtils.join(inputs, ",");
|
||||
} else {
|
||||
return StringUtils.join(inputs, ",") + "=>" + StringUtils.join(outputs, ",");
|
||||
}
|
||||
return StringUtils.join(inputs, ",") + "=>" + StringUtils.join(outputs, ",");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,12 +151,10 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback {
|
|||
final Throwable cause = e.getCause();
|
||||
if (cause instanceof ChildUrlsException) {
|
||||
((ChildUrlsException) cause).getChildUrlList().stream().map(RequestData::getUrl).forEach(urlQueue::offer);
|
||||
} else if (maxAccessCount != 1L) {
|
||||
throw e;
|
||||
} else {
|
||||
if (maxAccessCount != 1L) {
|
||||
throw e;
|
||||
} else {
|
||||
logger.warn("Failed to access {}.", processingUrl, e);
|
||||
}
|
||||
logger.warn("Failed to access {}.", processingUrl, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -512,12 +512,10 @@ public class SearchEngineClient implements Client {
|
|||
ComponentUtil.getCurlHelper().post("/_configsync/file").param("path", path).body(source).execute()) {
|
||||
if (response.getHttpStatusCode() == 200) {
|
||||
logger.info("Register {} to {}", path, index);
|
||||
} else if (response.getContentException() != null) {
|
||||
logger.warn("Invalid request for {}.", path, response.getContentException());
|
||||
} else {
|
||||
if (response.getContentException() != null) {
|
||||
logger.warn("Invalid request for {}.", path, response.getContentException());
|
||||
} else {
|
||||
logger.warn("Invalid request for {}. The response is {}", path, response.getContentAsString());
|
||||
}
|
||||
logger.warn("Invalid request for {}. The response is {}", path, response.getContentAsString());
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
|
|
|
@ -85,7 +85,6 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
|
|||
protected CrawlerClientFactory crawlerClientFactory = null;
|
||||
|
||||
public DataConfig() {
|
||||
super();
|
||||
setBoost(1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
|
|||
protected CrawlerClientFactory crawlerClientFactory = null;
|
||||
|
||||
public FileConfig() {
|
||||
super();
|
||||
setBoost(1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
protected CrawlerClientFactory crawlerClientFactory = null;
|
||||
|
||||
public WebConfig() {
|
||||
super();
|
||||
setBoost(1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.InputStreamReader;
|
|||
import java.lang.management.ManagementFactory;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -159,9 +160,7 @@ public class Crawler {
|
|||
|
||||
private static List<String> createConfigIdList(final String[] values) {
|
||||
final List<String> idList = new ArrayList<>();
|
||||
for (final String value : values) {
|
||||
idList.add(value);
|
||||
}
|
||||
Collections.addAll(idList, values);
|
||||
return idList;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ public class EncodingFilter implements Filter {
|
|||
locationBuf.append('/');
|
||||
locationBuf.append(servletPath.substring(path.length()));
|
||||
boolean append = false;
|
||||
final Map<String, String[]> parameterMap = new HashMap<>();
|
||||
parameterMap.putAll(req.getParameterMap());
|
||||
final Map<String, String[]> parameterMap = new HashMap<>(req.getParameterMap());
|
||||
parameterMap.putAll(getParameterMapFromQueryString(req, entry.getValue()));
|
||||
for (final Map.Entry<String, String[]> paramEntry : parameterMap.entrySet()) {
|
||||
final String[] values = paramEntry.getValue();
|
||||
|
|
|
@ -168,7 +168,7 @@ public class KeyMatchHelper {
|
|||
if (boostList == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (Tuple3<String, QueryBuilder, ScoreFunctionBuilder<?>> pair : boostList) {
|
||||
for (final Tuple3<String, QueryBuilder, ScoreFunctionBuilder<?>> pair : boostList) {
|
||||
if (!id.equals(pair.getValue1())) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ public class PluginHelper {
|
|||
|
||||
private final String id;
|
||||
|
||||
private ArtifactType(final String id) {
|
||||
ArtifactType(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,10 +49,8 @@ public class ProcessHelper {
|
|||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Stopping process {}", sessionId);
|
||||
}
|
||||
if (destroyProcess(sessionId) == 0) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Stopped process {}", sessionId);
|
||||
}
|
||||
if ((destroyProcess(sessionId) == 0) && logger.isInfoEnabled()) {
|
||||
logger.info("Stopped process {}", sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import static org.codelibs.core.stream.StreamUtil.stream;
|
|||
|
||||
import java.lang.Character.UnicodeBlock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -768,16 +769,12 @@ public class QueryHelper {
|
|||
|
||||
public void setApiResponseFields(final String[] fields) {
|
||||
apiResponseFieldSet = new HashSet<>();
|
||||
for (final String field : fields) {
|
||||
apiResponseFieldSet.add(field);
|
||||
}
|
||||
Collections.addAll(apiResponseFieldSet, fields);
|
||||
}
|
||||
|
||||
public void setNotAnalyzedFields(final String[] fields) {
|
||||
notAnalyzedFieldSet = new HashSet<>();
|
||||
for (final String field : fields) {
|
||||
notAnalyzedFieldSet.add(field);
|
||||
}
|
||||
Collections.addAll(notAnalyzedFieldSet, fields);
|
||||
}
|
||||
|
||||
public boolean isApiResponseField(final String field) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.time.ZoneId;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -147,21 +148,16 @@ public class SuggestHelper {
|
|||
final String sessionId;
|
||||
if (searchLog.getUserSessionId() != null) {
|
||||
sessionId = searchLog.getUserSessionId();
|
||||
} else if (Constants.SEARCH_LOG_ACCESS_TYPE_WEB.equals(searchLog.getAccessType())) {
|
||||
sessionId = searchLog.getClientIp();
|
||||
} else {
|
||||
if (Constants.SEARCH_LOG_ACCESS_TYPE_WEB.equals(searchLog.getAccessType())) {
|
||||
sessionId = searchLog.getClientIp();
|
||||
} else {
|
||||
sessionId = searchLog.getClientIp() + '_' + searchLog.getSearchWord();
|
||||
}
|
||||
sessionId = searchLog.getClientIp() + '_' + searchLog.getSearchWord();
|
||||
}
|
||||
|
||||
final LocalDateTime requestedAt = searchLog.getRequestedAt();
|
||||
if (sessionId == null) {
|
||||
if ((sessionId == null) || (duplicateSessionMap.containsKey(sessionId)
|
||||
&& duplicateSessionMap.get(sessionId).plusMinutes(searchStoreIntervalMinute).isAfter(requestedAt))) {
|
||||
return;
|
||||
} else if (duplicateSessionMap.containsKey(sessionId)) {
|
||||
if (duplicateSessionMap.get(sessionId).plusMinutes(searchStoreIntervalMinute).isAfter(requestedAt)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final StringBuilder sb = new StringBuilder(100);
|
||||
|
@ -343,15 +339,11 @@ public class SuggestHelper {
|
|||
|
||||
final List<String> labelList = new ArrayList<>();
|
||||
if (tags != null) {
|
||||
for (final String label : tags) {
|
||||
labelList.add(label);
|
||||
}
|
||||
Collections.addAll(labelList, tags);
|
||||
}
|
||||
final List<String> roleList = new ArrayList<>();
|
||||
if (permissions != null) {
|
||||
for (final String permission : permissions) {
|
||||
roleList.add(permission);
|
||||
}
|
||||
Collections.addAll(roleList, permissions);
|
||||
}
|
||||
|
||||
suggester.indexer().addElevateWord(new org.codelibs.fess.suggest.entity.ElevateWord(word, boost, Arrays.asList(readings),
|
||||
|
|
|
@ -436,9 +436,6 @@ public class ViewHelper {
|
|||
if (StringUtil.isNotBlank(mimetype)) {
|
||||
if ("application/pdf".equals(mimetype)) {
|
||||
return appendPDFSearchWord(url);
|
||||
} else {
|
||||
// TODO others..
|
||||
return url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,10 +388,8 @@ public class IndexUpdater extends Thread {
|
|||
} catch (final Exception e) {
|
||||
logger.warn("Could not add a doc: {}", accessResult.getUrl(), e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skipped. No content. ");
|
||||
}
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Skipped. No content. ");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -114,9 +115,7 @@ public abstract class ExecJob {
|
|||
}
|
||||
|
||||
public ExecJob jvmOptions(final String... options) {
|
||||
for (final String s : options) {
|
||||
this.jvmOptions.add(s);
|
||||
}
|
||||
Collections.addAll(this.jvmOptions, options);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,12 +79,10 @@ public class PingSearchEngineJob {
|
|||
}
|
||||
resultBuf.append("Status of ").append(ping.getClusterName()).append(" is changed to ").append(ping.getClusterStatus())
|
||||
.append('.');
|
||||
} else if (status == 0) {
|
||||
resultBuf.append(ping.getClusterName()).append(" is alive.");
|
||||
} else {
|
||||
if (status == 0) {
|
||||
resultBuf.append(ping.getClusterName()).append(" is alive.");
|
||||
} else {
|
||||
resultBuf.append(ping.getClusterName()).append(" is not available.");
|
||||
}
|
||||
resultBuf.append(ping.getClusterName()).append(" is not available.");
|
||||
}
|
||||
|
||||
return resultBuf.toString();
|
||||
|
|
|
@ -1035,10 +1035,7 @@ public interface FessProp {
|
|||
return lang1;
|
||||
}
|
||||
final String lang2 = mapping.get(s.split("[\\-_]")[0]);
|
||||
if (lang2 != null) {
|
||||
return lang2;
|
||||
}
|
||||
return null;
|
||||
return lang2;
|
||||
}).filter(StringUtil::isNotBlank).distinct().toArray(n -> new String[n]));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.apache.catalina.valves.ErrorReportValve;
|
|||
|
||||
public class SuppressErrorReportValve extends ErrorReportValve {
|
||||
public SuppressErrorReportValve() {
|
||||
super();
|
||||
setShowReport(false);
|
||||
setShowServerInfo(false);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.codelibs.fess.util;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -70,9 +71,7 @@ public final class DocumentUtil {
|
|||
return (T) value;
|
||||
} else if (clazz.isAssignableFrom(List.class)) {
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (final String s : (String[]) value) {
|
||||
list.add(s);
|
||||
}
|
||||
Collections.addAll(list, (String[]) value);
|
||||
return (T) list;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.util;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.core.stream.StreamUtil;
|
||||
|
@ -64,12 +66,7 @@ public class PrunedTag {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((css == null) ? 0 : css.hashCode());
|
||||
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
|
||||
return result;
|
||||
return Objects.hash(css, id, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,9 @@ public class RenderDataUtil {
|
|||
public static void register(final RenderData data, final String key, final Object value) {
|
||||
if (value == null) {
|
||||
return;
|
||||
} else if (value instanceof Entity) {
|
||||
}
|
||||
|
||||
if (value instanceof Entity) {
|
||||
data.register(key, BeanUtil.copyBeanToNewMap(value));
|
||||
} else if (value instanceof Collection<?>) {
|
||||
final Collection<?> coll = ((Collection<?>) value);
|
||||
|
|
|
@ -148,10 +148,8 @@ public class ResourceUtil {
|
|||
try {
|
||||
final ServletContext servletContext = ComponentUtil.getComponent(ServletContext.class);
|
||||
final String webinfPath = servletContext.getRealPath("/" + root + base);
|
||||
if (webinfPath != null) {
|
||||
if (Files.exists(Paths.get(webinfPath))) {
|
||||
return Paths.get(webinfPath, names);
|
||||
}
|
||||
if ((webinfPath != null) && Files.exists(Paths.get(webinfPath))) {
|
||||
return Paths.get(webinfPath, names);
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
// ignore
|
||||
|
|
|
@ -52,11 +52,10 @@ public final class SearchEngineUtil {
|
|||
return getXContentBuilderOutputStream((builder, params) -> xContent.toXContent(builder, params), xContentType);
|
||||
}
|
||||
|
||||
public static long scroll(String index, Function<SearchHit, Boolean> callback) {
|
||||
SearchEngineClient client = ComponentUtil.getSearchEngineClient();
|
||||
return client.<SearchHit> scrollSearch(index, searchRequestBuilder -> true, (searchResponse, hit) -> hit, hit -> {
|
||||
return callback.apply(hit);
|
||||
});
|
||||
public static long scroll(final String index, final Function<SearchHit, Boolean> callback) {
|
||||
final SearchEngineClient client = ComponentUtil.getSearchEngineClient();
|
||||
return client.<SearchHit> scrollSearch(index, searchRequestBuilder -> true, (searchResponse, hit) -> hit,
|
||||
hit -> callback.apply(hit));
|
||||
}
|
||||
|
||||
public interface XContentBuilderCallback {
|
||||
|
|
Loading…
Add table
Reference in a new issue