remove unused components, duplicate ex_q, and add queryParser into dixml
This commit is contained in:
parent
266922640d
commit
fb2f925876
15 changed files with 49 additions and 111 deletions
|
@ -139,15 +139,12 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY = "purge.suggest.searchlog.day";
|
||||
|
||||
public static final String AUTH_CIPHER = "authenticationCipher";
|
||||
|
||||
public static final String RETURN_PATH = "org.codelibs.fess.ReturnPath";
|
||||
|
||||
public static final String HIGHLIGHT_QUERIES = "org.codelibs.fess.Queries";
|
||||
|
||||
public static final String FIELD_LOGS = "org.codelibs.fess.FieldLogs";
|
||||
|
||||
public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
|
||||
public static final String ISO_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
|
||||
public static final int DONE_STATUS = 9999;
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.codelibs.fess.util.DocumentUtil;
|
||||
import org.codelibs.fess.util.FacetResponse;
|
||||
import org.codelibs.fess.util.FacetResponse.Field;
|
||||
import org.codelibs.fess.util.StreamUtil;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -693,7 +694,8 @@ public class JsonApiManager extends BaseApiManager {
|
|||
|
||||
@Override
|
||||
public String[] getExtraQueries() {
|
||||
return request.getParameterValues("ex_q");
|
||||
return StreamUtil.of(request.getParameterValues("ex_q")).filter(q -> StringUtil.isNotBlank(q)).distinct()
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -703,7 +705,8 @@ public class JsonApiManager extends BaseApiManager {
|
|||
|
||||
@Override
|
||||
public String[] getLanguages() {
|
||||
return request.getParameterValues("lang");
|
||||
return StreamUtil.of(request.getParameterValues("lang")).filter(q -> StringUtil.isNotBlank(q)).distinct()
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,11 +21,13 @@ import java.util.Map;
|
|||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.entity.FacetInfo;
|
||||
import org.codelibs.fess.entity.GeoInfo;
|
||||
import org.codelibs.fess.entity.SearchRequestParams;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.codelibs.fess.util.StreamUtil;
|
||||
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
|
||||
|
||||
/**
|
||||
|
@ -63,7 +65,7 @@ public class ListForm implements SearchRequestParams, Serializable {
|
|||
|
||||
@Override
|
||||
public String[] getExtraQueries() {
|
||||
return ex_q;
|
||||
return StreamUtil.of(ex_q).filter(q -> StringUtil.isNotBlank(q)).distinct().toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +103,7 @@ public class ListForm implements SearchRequestParams, Serializable {
|
|||
|
||||
@Override
|
||||
public String[] getLanguages() {
|
||||
return lang;
|
||||
return StreamUtil.of(lang).filter(q -> StringUtil.isNotBlank(q)).distinct().toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,11 +21,13 @@ import java.util.Map;
|
|||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.entity.FacetInfo;
|
||||
import org.codelibs.fess.entity.GeoInfo;
|
||||
import org.codelibs.fess.entity.SearchRequestParams;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.codelibs.fess.util.StreamUtil;
|
||||
import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
|
||||
|
||||
public class SearchForm implements SearchRequestParams, Serializable {
|
||||
|
@ -98,7 +100,7 @@ public class SearchForm implements SearchRequestParams, Serializable {
|
|||
|
||||
@Override
|
||||
public String[] getExtraQueries() {
|
||||
return ex_q;
|
||||
return StreamUtil.of(ex_q).filter(q -> StringUtil.isNotBlank(q)).distinct().toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -108,7 +110,7 @@ public class SearchForm implements SearchRequestParams, Serializable {
|
|||
|
||||
@Override
|
||||
public String[] getLanguages() {
|
||||
return lang;
|
||||
return StreamUtil.of(lang).filter(q -> StringUtil.isNotBlank(q)).distinct().toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -209,7 +209,8 @@ public class SearchAction extends FessSearchAction {
|
|||
protected String getPagingQuery(final SearchForm form) {
|
||||
final StringBuilder buf = new StringBuilder(200);
|
||||
if (form.ex_q != null) {
|
||||
StreamUtil.of(form.ex_q).filter(q -> StringUtil.isNotBlank(q)).forEach(q -> buf.append("&ex_q=").append(LaFunctions.u(q)));
|
||||
StreamUtil.of(form.ex_q).filter(q -> StringUtil.isNotBlank(q)).distinct()
|
||||
.forEach(q -> buf.append("&ex_q=").append(LaFunctions.u(q)));
|
||||
}
|
||||
if (StringUtil.isNotBlank(form.sort)) {
|
||||
buf.append("&sort=").append(LaFunctions.u(form.sort));
|
||||
|
|
|
@ -32,11 +32,9 @@ import javax.annotation.PostConstruct;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.queryparser.classic.ParseException;
|
||||
import org.apache.lucene.queryparser.classic.QueryParser;
|
||||
import org.apache.lucene.queryparser.ext.ExtendableQueryParser;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.FuzzyQuery;
|
||||
|
@ -94,6 +92,9 @@ public class QueryHelper implements Serializable {
|
|||
@Resource
|
||||
protected KeyMatchHelper keyMatchHelper;
|
||||
|
||||
@Resource
|
||||
protected QueryParser queryParser;
|
||||
|
||||
protected Set<String> apiResponseFieldSet;
|
||||
|
||||
protected Set<String> highlightFieldSet = new HashSet<>();
|
||||
|
@ -245,7 +246,6 @@ public class QueryHelper implements Serializable {
|
|||
}
|
||||
|
||||
public void buildBaseQuery(final QueryContext queryContext, final Consumer<QueryContext> context) {
|
||||
final QueryParser queryParser = getQueryParser();
|
||||
try {
|
||||
final Query query = queryParser.parse(queryContext.getQueryString());
|
||||
final QueryBuilder queryBuilder = convertQuery(queryContext, query);
|
||||
|
@ -262,10 +262,6 @@ public class QueryHelper implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
protected QueryParser getQueryParser() {
|
||||
return new ExtendableQueryParser(Constants.DEFAULT_FIELD, new WhitespaceAnalyzer());
|
||||
}
|
||||
|
||||
protected QueryBuilder convertQuery(final QueryContext context, final Query query) {
|
||||
if (query instanceof TermQuery) {
|
||||
return convertTermQuery(context, (TermQuery) query);
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
EFESS0001=Unsupported field name: {0}
|
||||
EFESS0002={0} is not supported as a facet field.
|
||||
EFESS0003={0} ({1}) is not supported as a facet query.
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
ESSC0001=Rethrew {0} as a runtime exception.
|
||||
ESSC0002=Failed to redirect to {0}.
|
||||
ESSC0003=
|
||||
ESSC0004=The path is null.
|
||||
ESSC0005=Could not create a parent directory of {0}
|
||||
ESSC0006=A parent directory of {0} is not a directory.
|
||||
ESSC0007={0} is not a file.
|
||||
ESSC0008=Could not store {0}
|
||||
|
||||
ISSC0001=Invalidated session. The username is {0}.
|
||||
ISSC0002="[LOGIN] USER: {0}
|
||||
ISSC0003="[LOGOUT] USER: {0}
|
|
@ -16,24 +16,27 @@
|
|||
<include path="crawler/client.xml" />
|
||||
<include path="crawler/mimetype.xml" />
|
||||
|
||||
<component name="authenticationCipher" class="org.codelibs.core.crypto.CachedCipher">
|
||||
<!-- CHANGE THE FOLLOWING KEY -->
|
||||
<property name="key">"1234567890123456"</property>
|
||||
</component>
|
||||
<component name="labelTypeHelper" class="org.codelibs.fess.helper.LabelTypeHelper">
|
||||
</component>
|
||||
<component name="keyMatchHelper" class="org.codelibs.fess.helper.KeyMatchHelper">
|
||||
</component>
|
||||
<component name="queryParser" class="org.apache.lucene.queryparser.ext.ExtendableQueryParser">
|
||||
<arg>org.codelibs.fess.Constants.DEFAULT_FIELD</arg>
|
||||
<arg>
|
||||
<component class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"></component>
|
||||
</arg>
|
||||
<property name="lowercaseExpandedTerms">false</property>
|
||||
</component>
|
||||
<component name="queryHelper" class="org.codelibs.fess.helper.QueryHelper">
|
||||
<property name="defaultFacetInfo">
|
||||
<component class="org.codelibs.fess.entity.FacetInfo">
|
||||
<property name="minCount">1</property>
|
||||
<property name="field">["label"]</property>
|
||||
<property name="query">[
|
||||
"timestamp:[now/d-1d TO now]",
|
||||
"timestamp:[now/d-7d TO now]",
|
||||
"timestamp:[now/d-1M TO now]",
|
||||
"timestamp:[now/d-1y TO now]",
|
||||
"timestamp:[now/d-1d TO *]",
|
||||
"timestamp:[now/d-7d TO *]",
|
||||
"timestamp:[now/d-1M TO *]",
|
||||
"timestamp:[now/d-1y TO *]",
|
||||
"content_length:[0 TO 9999]",
|
||||
"content_length:[10000 TO 99999]",
|
||||
"content_length:[100000 TO 499999]",
|
||||
|
@ -78,19 +81,19 @@
|
|||
<property name="title">"labels.facet_timestamp_title"</property>
|
||||
<postConstruct name="addQuery">
|
||||
<arg>"labels.facet_timestamp_1day"</arg>
|
||||
<arg>"timestamp:[now/d-1d TO now]"</arg>
|
||||
<arg>"timestamp:[now/d-1d TO *]"</arg>
|
||||
</postConstruct>
|
||||
<postConstruct name="addQuery">
|
||||
<arg>"labels.facet_timestamp_1week"</arg>
|
||||
<arg>"timestamp:[now/d-7d TO now]"</arg>
|
||||
<arg>"timestamp:[now/d-7d TO *]"</arg>
|
||||
</postConstruct>
|
||||
<postConstruct name="addQuery">
|
||||
<arg>"labels.facet_timestamp_1month"</arg>
|
||||
<arg>"timestamp:[now/d-1M TO now]"</arg>
|
||||
<arg>"timestamp:[now/d-1M TO *]"</arg>
|
||||
</postConstruct>
|
||||
<postConstruct name="addQuery">
|
||||
<arg>"labels.facet_timestamp_1year"</arg>
|
||||
<arg>"timestamp:[now/d-1y TO now]"</arg>
|
||||
<arg>"timestamp:[now/d-1y TO *]"</arg>
|
||||
</postConstruct>
|
||||
</component>
|
||||
</arg>
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
|
||||
"http://dbflute.org/meta/lastadi10.dtd">
|
||||
<components namespace="fessCrawler">
|
||||
<include path="crawler/container.xml"/>
|
||||
<include path="crawler/client.xml"/>
|
||||
<include path="crawler/rule.xml"/>
|
||||
<include path="crawler/filter.xml"/>
|
||||
<include path="crawler/interval.xml"/>
|
||||
<include path="crawler/extractor.xml"/>
|
||||
<include path="crawler/mimetype.xml"/>
|
||||
<include path="crawler/encoding.xml"/>
|
||||
<include path="crawler/urlconverter.xml"/>
|
||||
<include path="crawler/log.xml"/>
|
||||
<include path="crawler/sitemaps.xml"/>
|
||||
|
||||
<include path="crawler/es.xml"/>
|
||||
|
||||
<!-- Crawler -->
|
||||
<component name="crawler" class="org.codelibs.fess.crawler.Crawler" instance="prototype" >
|
||||
</component>
|
||||
|
||||
<!-- Crawler Thread -->
|
||||
<component name="crawlerThread" class="org.codelibs.fess.crawler.FessCrawlerThread" instance="prototype" >
|
||||
</component>
|
||||
|
||||
<!-- Entity -->
|
||||
<component name="accessResult"
|
||||
class="org.codelibs.fess.crawler.entity.EsAccessResult" instance="prototype">
|
||||
</component>
|
||||
<component name="urlQueue"
|
||||
class="org.codelibs.fess.crawler.entity.EsUrlQueue" instance="prototype">
|
||||
</component>
|
||||
|
||||
<!-- Service -->
|
||||
<component name="urlQueueService"
|
||||
class="org.codelibs.fess.crawler.service.impl.EsUrlQueueService">
|
||||
<property name="index">".crawler"</property>
|
||||
<property name="type">"queue"</property>
|
||||
</component>
|
||||
<component name="dataService"
|
||||
class="org.codelibs.fess.crawler.service.impl.EsDataService">
|
||||
<property name="index">".crawler"</property>
|
||||
<property name="type">"data"</property>
|
||||
</component>
|
||||
<component name="urlFilterService"
|
||||
class="org.codelibs.fess.crawler.service.impl.EsUrlFilterService">
|
||||
<property name="index">".crawler"</property>
|
||||
<property name="type">"filter"</property>
|
||||
</component>
|
||||
|
||||
</components>
|
8
src/main/resources/crawler_es+crawlerThread.xml
Normal file
8
src/main/resources/crawler_es+crawlerThread.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE components PUBLIC "-//DBFLUTE//DTD LastaDi 1.0//EN"
|
||||
"http://dbflute.org/meta/lastadi10.dtd">
|
||||
<components namespace="fessCrawler">
|
||||
<!-- Crawler Thread -->
|
||||
<component name="crawlerThread" class="org.codelibs.fess.crawler.FessCrawlerThread" instance="prototype" >
|
||||
</component>
|
||||
</components>
|
|
@ -23,16 +23,6 @@
|
|||
<component name="sambaHelper" class="org.codelibs.fess.helper.SambaHelper">
|
||||
</component>
|
||||
<component name="systemHelper" class="org.codelibs.fess.helper.SystemHelper">
|
||||
<!--
|
||||
<property name="javaCommandPath">"java"</property>
|
||||
<property name="filterPathEncoding">"UTF-8"</property>
|
||||
<property name="useOwnTmpDir">true</property>
|
||||
<property name="baseHelpLink">"http://fess.codelibs.org/{lang}/9.1/admin/"</property>
|
||||
<property name="supportedLanguages">new String[] { "ar", "bg", "ca",
|
||||
"cz", "da", "de", "el", "en", "es", "eu", "fa", "fi", "fr", "ga", "gl",
|
||||
"hi", "hu", "hy", "id", "it", "ja", "lv", "ko", "nl", "no", "pt",
|
||||
"ro", "ru", "sv", "th", "tr", "zh_CN", "zh_TW", "zh" }</property>
|
||||
-->
|
||||
<postConstruct name="addAdminRoles">
|
||||
<arg>["fess"]</arg>
|
||||
</postConstruct>
|
||||
|
|
|
@ -445,8 +445,8 @@ labels.wizard_crawling_config_title = \u30af\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a
|
|||
labels.wizard_crawling_setting_title = \u30af\u30ed\u30fc\u30eb\u306e\u8a2d\u5b9a
|
||||
labels.wizard_crawling_config_name = \u540d\u524d
|
||||
labels.wizard_crawling_config_path = \u30af\u30ed\u30fc\u30eb\u30d1\u30b9
|
||||
labels.wizard_button_register_again = \u518d\u5ea6\u4f5c\u6210
|
||||
labels.wizard_button_register_next = \u4f5c\u6210\u3057\u3066\u6b21\u3078
|
||||
labels.wizard_button_register_again = \u9023\u7d9a\u4f5c\u6210
|
||||
labels.wizard_button_register_next = \u4f5c\u6210
|
||||
labels.wizard_start_crawling_title = \u30af\u30ed\u30fc\u30eb\u306e\u958b\u59cb
|
||||
labels.wizard_start_crawler_title = \u30af\u30ed\u30fc\u30e9
|
||||
labels.wizard_start_crawling_desc = \u300c\u30af\u30ed\u30fc\u30eb\u306e\u958b\u59cb\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001\u3042\u306a\u305f\u306f\u4eca\u3001\u30af\u30ed\u30fc\u30eb\u3092\u958b\u59cb\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<include path="lastaflute_core.xml"/>
|
||||
<include path="fess.xml" />
|
||||
|
||||
<include path="crawler.xml" />
|
||||
<include path="crawler_es.xml" />
|
||||
|
||||
<component name="indexingHelper" class="org.codelibs.fess.helper.IndexingHelper">
|
||||
</component>
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
*/
|
||||
package org.codelibs.fess.helper;
|
||||
|
||||
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
|
||||
import org.apache.lucene.queryparser.classic.ParseException;
|
||||
import org.apache.lucene.queryparser.ext.ExtendableQueryParser;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.unit.UnitFessTestCase;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
|
@ -32,6 +35,7 @@ public class QueryHelperTest extends UnitFessTestCase {
|
|||
registerMockInstance(fessConfig);
|
||||
registerMockInstance(new SystemHelper());
|
||||
inject(queryHelper);
|
||||
queryHelper.queryParser = new ExtendableQueryParser(Constants.DEFAULT_FIELD, new WhitespaceAnalyzer());
|
||||
queryHelper.init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue