diff --git a/src/main/java/org/codelibs/fess/api/gsa/GsaApiManager.java b/src/main/java/org/codelibs/fess/api/gsa/GsaApiManager.java index 210098522..f121fd4b1 100644 --- a/src/main/java/org/codelibs/fess/api/gsa/GsaApiManager.java +++ b/src/main/java/org/codelibs/fess/api/gsa/GsaApiManager.java @@ -66,17 +66,8 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager { private static final String OUTPUT_XML = "xml"; // or xml_no_dtd // http://www.google.com/google.dtd. - @Deprecated - private static final String GSA_META_SUFFIX = "_s"; - protected String gsaPathPrefix = "/gsa"; - protected String gsaMetaPrefix = "MT_"; - - protected String charsetField = "charset"; - - protected String contentTypeField = "content_type"; - @PostConstruct public void register() { if (logger.isInfoEnabled()) { @@ -254,13 +245,12 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager { document.put("LANG", lang); document.remove(fessConfig.getIndexFieldLang()); } + final String gsaMetaPrefix = fessConfig.getQueryGsaMetaPrefix(); for (final Map.Entry entry : document.entrySet()) { final String name = entry.getKey(); if (StringUtil.isNotBlank(name) && entry.getValue() != null && fessConfig.isGsaResponseFields(name)) { if (name.startsWith(gsaMetaPrefix)) { - final String tagName = - name.replaceFirst("^" + gsaMetaPrefix, StringUtil.EMPTY).replaceAll(GSA_META_SUFFIX + "\\z", - StringUtil.EMPTY); + final String tagName = name.replaceFirst("^" + gsaMetaPrefix, StringUtil.EMPTY); if (getFields.contains(tagName)) { buf.append(" response.setHeader(e.getFirst(), e.getSecond())); diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index bd4b2aaeb..2cb88f2fa 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -699,6 +699,15 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. */ String QUERY_GSA_DEFAULT_SORT = "query.gsa.default.sort"; + /** The key of the configuration. e.g. MT_ */ + String QUERY_GSA_META_PREFIX = "query.gsa.meta.prefix"; + + /** The key of the configuration. e.g. charset */ + String QUERY_GSA_INDEX_FIELD_CHARSET = "query.gsa.index.field.charset"; + + /** The key of the configuration. e.g. content_type */ + String QUERY_GSA_INDEX_FIELD_content_type_ = "query.gsa.index.field.content_type."; + /** The key of the configuration. e.g. 4 */ String QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS = "query.collapse.max.concurrent.group.results"; @@ -3545,6 +3554,27 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ Integer getQueryGsaDefaultSortAsInteger(); + /** + * Get the value for the key 'query.gsa.meta.prefix'.
+ * The value is, e.g. MT_
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryGsaMetaPrefix(); + + /** + * Get the value for the key 'query.gsa.index.field.charset'.
+ * The value is, e.g. charset
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryGsaIndexFieldCharset(); + + /** + * Get the value for the key 'query.gsa.index.field.content_type.'.
+ * The value is, e.g. content_type
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryGsaIndexFieldContentType(); + /** * Get the value for the key 'query.collapse.max.concurrent.group.results'.
* The value is, e.g. 4
@@ -6990,6 +7020,18 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction return getAsInteger(FessConfig.QUERY_GSA_DEFAULT_SORT); } + public String getQueryGsaMetaPrefix() { + return get(FessConfig.QUERY_GSA_META_PREFIX); + } + + public String getQueryGsaIndexFieldCharset() { + return get(FessConfig.QUERY_GSA_INDEX_FIELD_CHARSET); + } + + public String getQueryGsaIndexFieldContentType() { + return get(FessConfig.QUERY_GSA_INDEX_FIELD_content_type_); + } + public String getQueryCollapseMaxConcurrentGroupResults() { return get(FessConfig.QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS); } @@ -8429,6 +8471,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction defaultMap.put(FessConfig.QUERY_GSA_RESPONSE_FIELDS, "UE,U,T,RK,S,LANG"); defaultMap.put(FessConfig.QUERY_GSA_DEFAULT_LANG, "en"); defaultMap.put(FessConfig.QUERY_GSA_DEFAULT_SORT, ""); + defaultMap.put(FessConfig.QUERY_GSA_META_PREFIX, "MT_"); + defaultMap.put(FessConfig.QUERY_GSA_INDEX_FIELD_CHARSET, "charset"); + defaultMap.put(FessConfig.QUERY_GSA_INDEX_FIELD_content_type_, "content_type"); defaultMap.put(FessConfig.QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS, "4"); defaultMap.put(FessConfig.QUERY_COLLAPSE_INNER_HITS_NAME, "similar_docs"); defaultMap.put(FessConfig.QUERY_COLLAPSE_INNER_HITS_SIZE, "0"); diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 354ee33a1..e11843fae 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -338,6 +338,9 @@ query.additional.not.analyzed.fields= query.gsa.response.fields=UE,U,T,RK,S,LANG query.gsa.default.lang=en query.gsa.default.sort= +query.gsa.meta.prefix=MT_ +query.gsa.index.field.charset=charset +query.gsa.index.field.content_type.=content_type query.collapse.max.concurrent.group.results=4 query.collapse.inner.hits.name=similar_docs query.collapse.inner.hits.size=0