use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class UserInfoHelper method createUserCodeFromUserId.
protected String createUserCodeFromUserId(String userCode) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final PrimaryCipher cipher = ComponentUtil.getPrimaryCipher();
userCode = cipher.encrypt(userCode);
if (fessConfig.isValidUserCode(userCode)) {
return userCode;
}
return null;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class UserInfoHelper method getUserCodeFromRequest.
protected String getUserCodeFromRequest(final HttpServletRequest request) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String userCode = request.getParameter(fessConfig.getUserCodeRequestParameter());
if (StringUtil.isBlank(userCode)) {
return null;
}
if (fessConfig.isValidUserCode(userCode)) {
request.setAttribute(Constants.USER_CODE, userCode);
return userCode;
}
return null;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class UserInfoHelper method getUserCodeFromCookie.
protected String getUserCodeFromCookie(final HttpServletRequest request) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (final Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName()) && fessConfig.isValidUserCode(cookie.getValue())) {
return cookie.getValue();
}
}
}
return null;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class IndexUpdater method getAccessResultList.
private List<EsAccessResult> getAccessResultList(final Consumer<SearchRequestBuilder> cb, final long cleanupTime) {
if (logger.isDebugEnabled()) {
logger.debug("Getting documents in IndexUpdater queue.");
}
final long execTime = System.currentTimeMillis();
final List<EsAccessResult> arList = ((EsDataService) dataService).getAccessResultList(cb);
final FessConfig fessConfig = ComponentUtil.getFessConfig();
if (!arList.isEmpty()) {
final long commitMarginTime = fessConfig.getIndexerWebfsCommitMarginTimeAsInteger().longValue();
for (final AccessResult<?> ar : arList.toArray(new AccessResult[arList.size()])) {
if (ar.getCreateTime().longValue() > execTime - commitMarginTime) {
arList.remove(ar);
}
}
}
final long totalHits = ((EsResultList<EsAccessResult>) arList).getTotalHits();
if (logger.isInfoEnabled()) {
final StringBuilder buf = new StringBuilder(100);
buf.append("Processing ");
if (totalHits > 0) {
buf.append(arList.size()).append('/').append(totalHits).append(" docs (Doc:{access ");
} else {
buf.append("no docs in indexing queue (Doc:{access ");
}
buf.append(System.currentTimeMillis() - execTime).append("ms");
if (cleanupTime >= 0) {
buf.append(", cleanup ").append(cleanupTime).append("ms");
}
buf.append("}, ");
buf.append(MemoryUtil.getMemoryUsageLog());
buf.append(')');
logger.info(buf.toString());
}
final long unprocessedDocumentSize = fessConfig.getIndexerUnprocessedDocumentSizeAsInteger().longValue();
final IntervalControlHelper intervalControlHelper = ComponentUtil.getIntervalControlHelper();
if (totalHits > unprocessedDocumentSize && intervalControlHelper.isCrawlerRunning()) {
if (logger.isInfoEnabled()) {
logger.info("Stopped all crawler threads. You have {} (>{}) unprocessed docs.", totalHits, unprocessedDocumentSize);
}
intervalControlHelper.setCrawlerRunning(false);
}
return arList;
}
use of org.codelibs.fess.mylasta.direction.FessConfig in project fess by codelibs.
the class IndexUpdater method updateDocument.
protected void updateDocument(final Map<String, Object> map) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
if (fessConfig.getIndexerClickCountEnabledAsBoolean()) {
addClickCountField(map);
}
if (fessConfig.getIndexerFavoriteCountEnabledAsBoolean()) {
addFavoriteCountField(map);
}
float documentBoost = 0.0f;
for (final DocBoostMatcher docBoostMatcher : docBoostMatcherList) {
if (docBoostMatcher.match(map)) {
documentBoost = docBoostMatcher.getValue(map);
break;
}
}
if (documentBoost > 0) {
addBoostValue(map, documentBoost);
}
if (!map.containsKey(fessConfig.getIndexFieldDocId())) {
map.put(fessConfig.getIndexFieldDocId(), systemHelper.generateDocId(map));
}
ComponentUtil.getLanguageHelper().updateDocument(map);
}
Aggregations