Github user albertostratio commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/21#discussion_r29323171
  
    --- Diff: 
mongodb/src/main/java/org/apache/metamodel/mongodb/MongoDbDataContext.java ---
    @@ -435,6 +442,19 @@ private String getOperatorName(FilterItem item) {
             return operatorName;
         }
     
    +    private Pattern turnOperandIntoRegExp(Object operand) {
    +        String operandAsString = operand.toString();
    +        StringBuilder operandAsRegExp = new 
StringBuilder(replaceWildCardLikeChars(operandAsString));
    +        if (!operandAsString.startsWith("%") && 
operandAsString.contains("%")) {
    +            operandAsRegExp = operandAsRegExp.insert(0, "^");
    +        }
    +        return Pattern.compile(operandAsRegExp.toString(), 
Pattern.CASE_INSENSITIVE);
    +    }
    --- End diff --
    
    Really good point in here! I've just modified the code to always prepend ^ 
and append $ and the tests are all passing OK. Thank you for the comment! I'll 
be pushing the changes right now...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to