Procházet zdrojové kódy

fix #1392 add query.additional.analyzed.fields

Shinsuke Sugaya před 7 roky
rodič
revize
eaf3d7e331

+ 3 - 0
src/main/java/org/codelibs/fess/helper/QueryHelper.java

@@ -16,6 +16,7 @@
 package org.codelibs.fess.helper;
 package org.codelibs.fess.helper;
 
 
 import static org.codelibs.core.stream.StreamUtil.stream;
 import static org.codelibs.core.stream.StreamUtil.stream;
+import static org.codelibs.core.stream.StreamUtil.split;
 
 
 import java.lang.Character.UnicodeBlock;
 import java.lang.Character.UnicodeBlock;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -282,6 +283,8 @@ public class QueryHelper {
                     fessConfig.getIndexFieldUrl(), //
                     fessConfig.getIndexFieldUrl(), //
                     fessConfig.getIndexFieldVersion()));
                     fessConfig.getIndexFieldVersion()));
         }
         }
+        split(fessConfig.getQueryAdditionalAnalyzedFields(), ",").of(
+                stream -> stream.map(s -> s.trim()).filter(StringUtil::isNotBlank).forEach(s -> notAnalyzedFieldSet.remove(s)));
     }
     }
 
 
     public QueryContext build(final SearchRequestType searchRequestType, final String query, final Consumer<QueryContext> context) {
     public QueryContext build(final SearchRequestType searchRequestType, final String query, final Consumer<QueryContext> context) {

+ 27 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -558,6 +558,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g.  */
     /** The key of the configuration. e.g.  */
     String QUERY_ADDITIONAL_SORT_FIELDS = "query.additional.sort.fields";
     String QUERY_ADDITIONAL_SORT_FIELDS = "query.additional.sort.fields";
 
 
+    /** The key of the configuration. e.g.  */
+    String QUERY_ADDITIONAL_ANALYZED_FIELDS = "query.additional.analyzed.fields";
+
     /** The key of the configuration. e.g.  */
     /** The key of the configuration. e.g.  */
     String QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS = "query.additional.not.analyzed.fields";
     String QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS = "query.additional.not.analyzed.fields";
 
 
@@ -3003,6 +3006,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
      */
     Integer getQueryAdditionalSortFieldsAsInteger();
     Integer getQueryAdditionalSortFieldsAsInteger();
 
 
+    /**
+     * Get the value for the key 'query.additional.analyzed.fields'. <br>
+     * The value is, e.g.  <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getQueryAdditionalAnalyzedFields();
+
+    /**
+     * Get the value for the key 'query.additional.analyzed.fields' as {@link Integer}. <br>
+     * The value is, e.g.  <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     * @throws NumberFormatException When the property is not integer.
+     */
+    Integer getQueryAdditionalAnalyzedFieldsAsInteger();
+
     /**
     /**
      * Get the value for the key 'query.additional.not.analyzed.fields'. <br>
      * Get the value for the key 'query.additional.not.analyzed.fields'. <br>
      * The value is, e.g.  <br>
      * The value is, e.g.  <br>
@@ -6396,6 +6414,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return getAsInteger(FessConfig.QUERY_ADDITIONAL_SORT_FIELDS);
             return getAsInteger(FessConfig.QUERY_ADDITIONAL_SORT_FIELDS);
         }
         }
 
 
+        public String getQueryAdditionalAnalyzedFields() {
+            return get(FessConfig.QUERY_ADDITIONAL_ANALYZED_FIELDS);
+        }
+
+        public Integer getQueryAdditionalAnalyzedFieldsAsInteger() {
+            return getAsInteger(FessConfig.QUERY_ADDITIONAL_ANALYZED_FIELDS);
+        }
+
         public String getQueryAdditionalNotAnalyzedFields() {
         public String getQueryAdditionalNotAnalyzedFields() {
             return get(FessConfig.QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS);
             return get(FessConfig.QUERY_ADDITIONAL_NOT_ANALYZED_FIELDS);
         }
         }
@@ -7895,6 +7921,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_SEARCH_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_SEARCH_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_FACET_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_FACET_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_SORT_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_SORT_FIELDS, "");
+            defaultMap.put(FessConfig.QUERY_ADDITIONAL_ANALYZED_FIELDS, "");
             defaultMap.put(FessConfig.QUERY_ADDITIONAL_NOT_ANALYZED_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_GSA_RESPONSE_FIELDS, "UE,U,T,RK,S,LANG");
             defaultMap.put(FessConfig.QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS, "4");
             defaultMap.put(FessConfig.QUERY_COLLAPSE_MAX_CONCURRENT_GROUP_RESULTS, "4");

+ 1 - 0
src/main/resources/fess_config.properties

@@ -263,6 +263,7 @@ query.additional.highlighted.fields=
 query.additional.search.fields=
 query.additional.search.fields=
 query.additional.facet.fields=
 query.additional.facet.fields=
 query.additional.sort.fields=
 query.additional.sort.fields=
+query.additional.analyzed.fields=
 query.additional.not.analyzed.fields=
 query.additional.not.analyzed.fields=
 query.gsa.response.fields=UE,U,T,RK,S,LANG
 query.gsa.response.fields=UE,U,T,RK,S,LANG
 query.collapse.max.concurrent.group.results=4
 query.collapse.max.concurrent.group.results=4