Explorar el Código

fix #2727 check opensearchexception on query processing

Shinsuke Sugaya hace 2 años
padre
commit
7edb18d39b

+ 6 - 0
src/main/java/org/codelibs/fess/es/client/SearchEngineClient.java

@@ -948,6 +948,12 @@ public class SearchEngineClient implements Client {
             } catch (final SearchPhaseExecutionException e) {
             } catch (final SearchPhaseExecutionException e) {
                 throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryParseError(UserMessages.GLOBAL_PROPERTY_KEY),
                 throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryParseError(UserMessages.GLOBAL_PROPERTY_KEY),
                         "Invalid query: " + searchRequestBuilder, e);
                         "Invalid query: " + searchRequestBuilder, e);
+            } catch (final OpenSearchException e) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Cannot process {}", searchRequestBuilder, e);
+                }
+                throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryCannotProcess(UserMessages.GLOBAL_PROPERTY_KEY),
+                        "Failed query: " + searchRequestBuilder, e);
             }
             }
         }
         }
         final long execTime = System.currentTimeMillis() - startTime;
         final long execTime = System.currentTimeMillis() - startTime;

+ 17 - 0
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java

@@ -380,6 +380,9 @@ public class FessMessages extends FessLabels {
     /** The key of the message: The given sort order ({0}) is not supported. */
     /** The key of the message: The given sort order ({0}) is not supported. */
     public static final String ERRORS_invalid_query_unsupported_sort_order = "{errors.invalid_query_unsupported_sort_order}";
     public static final String ERRORS_invalid_query_unsupported_sort_order = "{errors.invalid_query_unsupported_sort_order}";
 
 
+    /** The key of the message: The given query could not be processed. */
+    public static final String ERRORS_invalid_query_cannot_process = "{errors.invalid_query_cannot_process}";
+
     /** The key of the message: Invalid mode(expected value is {0}, but it's {1}). */
     /** The key of the message: Invalid mode(expected value is {0}, but it's {1}). */
     public static final String ERRORS_crud_invalid_mode = "{errors.crud_invalid_mode}";
     public static final String ERRORS_crud_invalid_mode = "{errors.crud_invalid_mode}";
 
 
@@ -2245,6 +2248,20 @@ public class FessMessages extends FessLabels {
         return this;
         return this;
     }
     }
 
 
+    /**
+     * Add the created action message for the key 'errors.invalid_query_cannot_process' with parameters.
+     * <pre>
+     * message: The given query could not be processed.
+     * </pre>
+     * @param property The property name for the message. (NotNull)
+     * @return this. (NotNull)
+     */
+    public FessMessages addErrorsInvalidQueryCannotProcess(String property) {
+        assertPropertyNotNull(property);
+        add(property, new UserMessage(ERRORS_invalid_query_cannot_process));
+        return this;
+    }
+
     /**
     /**
      * Add the created action message for the key 'errors.crud_invalid_mode' with parameters.
      * Add the created action message for the key 'errors.crud_invalid_mode' with parameters.
      * <pre>
      * <pre>

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

@@ -149,6 +149,7 @@ errors.invalid_query_parse_error=The given query is invalid.
 errors.invalid_query_sort_value=The given sort ({0}) is invalid.
 errors.invalid_query_sort_value=The given sort ({0}) is invalid.
 errors.invalid_query_unsupported_sort_field=The given sort ({0}) is not supported.
 errors.invalid_query_unsupported_sort_field=The given sort ({0}) is not supported.
 errors.invalid_query_unsupported_sort_order=The given sort order ({0}) is not supported.
 errors.invalid_query_unsupported_sort_order=The given sort order ({0}) is not supported.
+errors.invalid_query_cannot_process=The given query could not be processed.
 
 
 errors.crud_invalid_mode=Invalid mode(expected value is {0}, but it's {1}).
 errors.crud_invalid_mode=Invalid mode(expected value is {0}, but it's {1}).
 errors.crud_failed_to_create_instance=Failed to create a new data.
 errors.crud_failed_to_create_instance=Failed to create a new data.

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

@@ -145,6 +145,7 @@ errors.invalid_query_parse_error=The given query is invalid.
 errors.invalid_query_sort_value=The given sort ({0}) is invalid.
 errors.invalid_query_sort_value=The given sort ({0}) is invalid.
 errors.invalid_query_unsupported_sort_field=The given sort ({0}) is not supported.
 errors.invalid_query_unsupported_sort_field=The given sort ({0}) is not supported.
 errors.invalid_query_unsupported_sort_order=The given sort order ({0}) is not supported.
 errors.invalid_query_unsupported_sort_order=The given sort order ({0}) is not supported.
+errors.invalid_query_cannot_process=The given query could not be processed.
 
 
 errors.crud_invalid_mode=Invalid mode(expected value is {0}, but it's {1}).
 errors.crud_invalid_mode=Invalid mode(expected value is {0}, but it's {1}).
 errors.crud_failed_to_create_instance=Failed to create a new data.
 errors.crud_failed_to_create_instance=Failed to create a new data.

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

@@ -124,6 +124,7 @@ errors.invalid_query_parse_error = 与えられたクエリーは無効です。
 errors.invalid_query_sort_value = 指定されたソート {0} が無効です。
 errors.invalid_query_sort_value = 指定されたソート {0} が無効です。
 errors.invalid_query_unsupported_sort_field = 指定されたソート {0} はサポートされていません。
 errors.invalid_query_unsupported_sort_field = 指定されたソート {0} はサポートされていません。
 errors.invalid_query_unsupported_sort_order = 指定されたソート順 {0} はサポートされていません。
 errors.invalid_query_unsupported_sort_order = 指定されたソート順 {0} はサポートされていません。
+errors.invalid_query_cannot_process=指定されたクエリーを処理できませんでした。
 errors.crud_invalid_mode = モードが正しくありません。({0} でなく、{1} です)
 errors.crud_invalid_mode = モードが正しくありません。({0} でなく、{1} です)
 errors.crud_failed_to_create_instance = 新しいデータの作成に失敗しました。
 errors.crud_failed_to_create_instance = 新しいデータの作成に失敗しました。
 errors.crud_failed_to_create_crud_table = 新しいデータの作成に失敗しました。({0})
 errors.crud_failed_to_create_crud_table = 新しいデータの作成に失敗しました。({0})