Arsnael commented on code in PR #2812:
URL: https://github.com/apache/james-project/pull/2812#discussion_r2354123331
##########
mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/query/DefaultCriterionConverter.java:
##########
@@ -331,21 +330,33 @@ protected Query
convertTextCriterion(SearchQuery.TextCriterion textCriterion) {
.toQuery();
}
case ATTACHMENT_FILE_NAME:
- return new BoolQuery.Builder()
- .should(new MatchQuery.Builder()
- .field(JsonMessageConstants.ATTACHMENTS + "." +
JsonMessageConstants.Attachment.FILENAME)
- .query(new
FieldValue.Builder().stringValue(textCriterion.getOperator().getValue()).build())
- .fuzziness(textFuzzinessSearchValue)
- .operator(Operator.And)
+ if (useQueryStringQuery &&
QUERY_STRING_CONTROL_CHAR.matchesAnyOf(textCriterion.getOperator().getValue()))
{
+ return new BoolQuery.Builder()
+ .should(new SimpleQueryStringQuery.Builder()
+
.fields(ImmutableList.of(JsonMessageConstants.ATTACHMENTS + "." +
JsonMessageConstants.Attachment.FILENAME))
+ .query(textCriterion.getOperator().getValue())
+ .defaultOperator(Operator.And)
+ .lenient(true)
+ .build().toQuery())
.build()
- .toQuery())
- .should(new TermQuery.Builder()
- .field(JsonMessageConstants.ATTACHMENTS + "." +
JsonMessageConstants.Attachment.FILE_EXTENSION)
- .value(new
FieldValue.Builder().stringValue(textCriterion.getOperator().getValue()).build())
Review Comment:
He does, below in the else... Github just made a bit of a mess on the diff
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]