fix #2727 check opensearchexception on query processing

This commit is contained in:
Shinsuke Sugaya 2023-03-18 12:05:44 +09:00
parent 1141fdf774
commit 7edb18d39b
5 changed files with 26 additions and 0 deletions

View file

@ -948,6 +948,12 @@ public class SearchEngineClient implements Client {
} catch (final SearchPhaseExecutionException e) {
throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryParseError(UserMessages.GLOBAL_PROPERTY_KEY),
"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;

View file

@ -380,6 +380,9 @@ public class FessMessages extends FessLabels {
/** 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}";
/** 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}). */
public static final String ERRORS_crud_invalid_mode = "{errors.crud_invalid_mode}";
@ -2245,6 +2248,20 @@ public class FessMessages extends FessLabels {
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.
* <pre>

View file

@ -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_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_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_failed_to_create_instance=Failed to create a new data.

View file

@ -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_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_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_failed_to_create_instance=Failed to create a new data.

View file

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