fix #1226 add query.gsa.response.fields
This commit is contained in:
parent
ec5a7de190
commit
b552e57fe1
4 changed files with 37 additions and 3 deletions
|
@ -221,10 +221,11 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
for (final Map.Entry<String, Object> entry : document.entrySet()) {
|
||||
final String name = entry.getKey();
|
||||
if (StringUtil.isNotBlank(name) && entry.getValue() != null
|
||||
&& ComponentUtil.getQueryHelper().isApiResponseField(name)) {
|
||||
if (StringUtil.isNotBlank(name) && entry.getValue() != null && fessConfig.isGsaResponseFields(name)) {
|
||||
if (name.startsWith(gsaMetaPrefix)) {
|
||||
final String tagName = name.replaceAll("^" + gsaMetaPrefix, "").replaceAll(GSA_META_SUFFIX + "\\z", "");
|
||||
final String tagName =
|
||||
name.replaceFirst("^" + gsaMetaPrefix, StringUtil.EMPTY).replaceAll(GSA_META_SUFFIX + "\\z",
|
||||
StringUtil.EMPTY);
|
||||
if (getFields != null && getFields.contains(tagName)) {
|
||||
buf.append("<MT N=\"");
|
||||
buf.append(tagName);
|
||||
|
|
|
@ -525,6 +525,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
/** The key of the configuration. e.g. */
|
||||
String QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS = "query.additional.not.analyzed.fields";
|
||||
|
||||
/** The key of the configuration. e.g. UE,U,T,RK,S,LANG */
|
||||
String QUERY_GSA_RESPONSE_FIELDS = "query.gsa.response.fields";
|
||||
|
||||
/** The key of the configuration. e.g. 4 */
|
||||
String QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS = "query.collapse.max.concurrent.group.results";
|
||||
|
||||
|
@ -2866,6 +2869,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
Integer getQueryAdditionalNotAnalyzedFieldsAsInteger();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.gsa.response.fields'. <br>
|
||||
* The value is, e.g. UE,U,T,RK,S,LANG <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getQueryGsaResponseFields();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.collapse.max.concurrent.group.results'. <br>
|
||||
* The value is, e.g. 4 <br>
|
||||
|
@ -6143,6 +6153,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return getAsInteger(FessConfig.QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS);
|
||||
}
|
||||
|
||||
public String getQueryGsaResponseFields() {
|
||||
return get(FessConfig.QUERY_GSA_RESPONSE_FIELDS);
|
||||
}
|
||||
|
||||
public String getQueryCollapseMaxConcurrentGroupResults() {
|
||||
return get(FessConfig.QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS);
|
||||
}
|
||||
|
@ -7593,6 +7607,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
defaultMap.put(FessConfig.QUERY_ADDITIONAL_FACET_FIELDS, "");
|
||||
defaultMap.put(FessConfig.QUERY_ADDITIONAL_SORT_FIELDS, "");
|
||||
defaultMap.put(FessConfig.QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS, "");
|
||||
defaultMap.put(FessConfig.QUERY_GSA_RESPONSE_FIELDS, "UE,U,T,RK,S,LANG");
|
||||
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");
|
||||
|
|
|
@ -71,6 +71,8 @@ import org.lastaflute.web.validation.theme.typed.LongTypeValidator;
|
|||
|
||||
public interface FessProp {
|
||||
|
||||
public static final String QUERY_GSA_RESPONSE_FIELDS = "queryGsaResponseFields";
|
||||
|
||||
public static final String THUMBNAIL_HTML_IMAGE_EXCLUDE_EXTENSIONS = "ThumbnailHtmlImageExcludeExtensions";
|
||||
|
||||
public static final String VIRTUAL_HOST_VALUE = "VirtualHostValue";
|
||||
|
@ -1771,4 +1773,19 @@ public interface FessProp {
|
|||
return !stream(excludeExtensions).get(stream -> stream.anyMatch(s -> u.endsWith(s)));
|
||||
}
|
||||
|
||||
String getQueryGsaResponseFields();
|
||||
|
||||
public default boolean isGsaResponseFields(final String name) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<String> gsaResponseFieldSet = (Set<String>) propMap.get(QUERY_GSA_RESPONSE_FIELDS);
|
||||
if (gsaResponseFieldSet == null) {
|
||||
gsaResponseFieldSet =
|
||||
split(getQueryGsaResponseFields(), ",").get(
|
||||
stream -> stream.map(s -> s.toLowerCase(Locale.ROOT).trim()).filter(StringUtil::isNotBlank)
|
||||
.collect(Collectors.toSet()));
|
||||
propMap.put(QUERY_GSA_RESPONSE_FIELDS, gsaResponseFieldSet);
|
||||
}
|
||||
return gsaResponseFieldSet.contains(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -238,6 +238,7 @@ query.additional.search.fields=
|
|||
query.additional.facet.fields=
|
||||
query.additional.sort.fields=
|
||||
query.additional.not.analyzed.fields=
|
||||
query.gsa.response.fields=UE,U,T,RK,S,LANG
|
||||
query.collapse.max.concurrent.group.results=4
|
||||
query.collapse.inner.hits.name=similar_docs
|
||||
query.collapse.inner.hits.size=0
|
||||
|
|
Loading…
Add table
Reference in a new issue