Procházet zdrojové kódy

fix #383 : replace with content_description

Shinsuke Sugaya před 9 roky
rodič
revize
f2870f94a4

+ 2 - 1
src/main/java/org/codelibs/fess/helper/QueryHelper.java

@@ -187,7 +187,8 @@ public class QueryHelper implements Serializable {
                             fessConfig.getIndexFieldClickCount(), fessConfig.getIndexFieldFavoriteCount() };
                             fessConfig.getIndexFieldClickCount(), fessConfig.getIndexFieldFavoriteCount() };
         }
         }
         if (apiResponseFieldSet == null) {
         if (apiResponseFieldSet == null) {
-            setApiResponseFields(new String[] { "urlLink", "contentDescription", fessConfig.getIndexFieldId(),
+            setApiResponseFields(new String[] { fessConfig.getResponseFieldContentDescription(), fessConfig.getResponseFieldContentTitle(),
+                    fessConfig.getResponseFieldSitePath(), fessConfig.getResponseFieldUrlLink(), fessConfig.getIndexFieldId(),
                     fessConfig.getIndexFieldDocId(), fessConfig.getIndexFieldBoost(), fessConfig.getIndexFieldContentLength(),
                     fessConfig.getIndexFieldDocId(), fessConfig.getIndexFieldBoost(), fessConfig.getIndexFieldContentLength(),
                     fessConfig.getIndexFieldHost(), fessConfig.getIndexFieldSite(), fessConfig.getIndexFieldLastModified(),
                     fessConfig.getIndexFieldHost(), fessConfig.getIndexFieldSite(), fessConfig.getIndexFieldLastModified(),
                     fessConfig.getIndexFieldTimestamp(), fessConfig.getIndexFieldMimetype(), fessConfig.getIndexFieldFiletype(),
                     fessConfig.getIndexFieldTimestamp(), fessConfig.getIndexFieldMimetype(), fessConfig.getIndexFieldFiletype(),

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

@@ -322,6 +322,18 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. filetype */
     /** The key of the configuration. e.g. filetype */
     String INDEX_FIELD_FILETYPE = "index.field.filetype";
     String INDEX_FIELD_FILETYPE = "index.field.filetype";
 
 
+    /** The key of the configuration. e.g. content_title */
+    String RESPONSE_FIELD_content_title = "response.field.content_title";
+
+    /** The key of the configuration. e.g. content_description */
+    String RESPONSE_FIELD_content_description = "response.field.content_description";
+
+    /** The key of the configuration. e.g. url_link */
+    String RESPONSE_FIELD_url_link = "response.field.url_link";
+
+    /** The key of the configuration. e.g. site_path */
+    String RESPONSE_FIELD_site_path = "response.field.site_path";
+
     /** The key of the configuration. e.g. fess */
     /** The key of the configuration. e.g. fess */
     String INDEX_DOCUMENT_SEARCH_INDEX = "index.document.search.index";
     String INDEX_DOCUMENT_SEARCH_INDEX = "index.document.search.index";
 
 
@@ -1795,6 +1807,34 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
      */
     String getIndexFieldFiletype();
     String getIndexFieldFiletype();
 
 
+    /**
+     * Get the value for the key 'response.field.content_title'. <br>
+     * The value is, e.g. content_title <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getResponseFieldContentTitle();
+
+    /**
+     * Get the value for the key 'response.field.content_description'. <br>
+     * The value is, e.g. content_description <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getResponseFieldContentDescription();
+
+    /**
+     * Get the value for the key 'response.field.url_link'. <br>
+     * The value is, e.g. url_link <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getResponseFieldUrlLink();
+
+    /**
+     * Get the value for the key 'response.field.site_path'. <br>
+     * The value is, e.g. site_path <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getResponseFieldSitePath();
+
     /**
     /**
      * Get the value for the key 'index.document.search.index'. <br>
      * Get the value for the key 'index.document.search.index'. <br>
      * The value is, e.g. fess <br>
      * The value is, e.g. fess <br>
@@ -4049,6 +4089,22 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return get(FessConfig.INDEX_FIELD_FILETYPE);
             return get(FessConfig.INDEX_FIELD_FILETYPE);
         }
         }
 
 
+        public String getResponseFieldContentTitle() {
+            return get(FessConfig.RESPONSE_FIELD_content_title);
+        }
+
+        public String getResponseFieldContentDescription() {
+            return get(FessConfig.RESPONSE_FIELD_content_description);
+        }
+
+        public String getResponseFieldUrlLink() {
+            return get(FessConfig.RESPONSE_FIELD_url_link);
+        }
+
+        public String getResponseFieldSitePath() {
+            return get(FessConfig.RESPONSE_FIELD_site_path);
+        }
+
         public String getIndexDocumentSearchIndex() {
         public String getIndexDocumentSearchIndex() {
             return get(FessConfig.INDEX_DOCUMENT_SEARCH_INDEX);
             return get(FessConfig.INDEX_DOCUMENT_SEARCH_INDEX);
         }
         }

+ 6 - 4
src/main/java/org/codelibs/fess/util/QueryResponseList.java

@@ -26,6 +26,7 @@ import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.codelibs.fess.helper.QueryHelper;
 import org.codelibs.fess.helper.QueryHelper;
 import org.codelibs.fess.helper.ViewHelper;
 import org.codelibs.fess.helper.ViewHelper;
+import org.codelibs.fess.mylasta.direction.FessConfig;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalEntity;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.common.text.Text;
 import org.elasticsearch.common.text.Text;
@@ -129,10 +130,11 @@ public class QueryResponseList implements List<Map<String, Object>> {
                     // ContentTitle
                     // ContentTitle
                     final ViewHelper viewHelper = ComponentUtil.getViewHelper();
                     final ViewHelper viewHelper = ComponentUtil.getViewHelper();
                     if (viewHelper != null) {
                     if (viewHelper != null) {
-                        docMap.put("contentTitle", viewHelper.getContentTitle(docMap));
-                        docMap.put("contentDescription", viewHelper.getContentDescription(docMap));
-                        docMap.put("urlLink", viewHelper.getUrlLink(docMap));
-                        docMap.put("sitePath", viewHelper.getSitePath(docMap));
+                        final FessConfig fessConfig = ComponentUtil.getFessConfig();
+                        docMap.put(fessConfig.getResponseFieldContentTitle(), viewHelper.getContentTitle(docMap));
+                        docMap.put(fessConfig.getResponseFieldContentDescription(), viewHelper.getContentDescription(docMap));
+                        docMap.put(fessConfig.getResponseFieldUrlLink(), viewHelper.getUrlLink(docMap));
+                        docMap.put(fessConfig.getResponseFieldSitePath(), viewHelper.getSitePath(docMap));
                     }
                     }
 
 
                     parent.add(docMap);
                     parent.add(docMap);

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

@@ -158,6 +158,10 @@ index.field.host=host
 index.field.site=site
 index.field.site=site
 index.field.content_length=content_length
 index.field.content_length=content_length
 index.field.filetype=filetype
 index.field.filetype=filetype
+response.field.content_title=content_title
+response.field.content_description=content_description
+response.field.url_link=url_link
+response.field.site_path=site_path
 
 
 # document index
 # document index
 index.document.search.index=fess
 index.document.search.index=fess