You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/06/14 21:41:36 UTC

[GitHub] [solr] kiranchitturi opened a new pull request, #905: SOLR-16250 Fix LIKE for string fields and multi terms

kiranchitturi opened a new pull request, #905:
URL: https://github.com/apache/solr/pull/905

   https://issues.apache.org/jira/browse/SOLR-16250
   
   # Description
   
   Solr SQL is not translating LIKE terms properly for string fields with multiple terms
   
   # Solution
   
   If the field type is string, do not use complex phrase parser and do not decode space
   
   # Tests
   
   Update existing unit test to verify
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] madrob commented on a diff in pull request #905: SOLR-16250 Fix LIKE for string fields and multi terms

Posted by GitBox <gi...@apache.org>.
madrob commented on code in PR #905:
URL: https://github.com/apache/solr/pull/905#discussion_r897379088


##########
solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java:
##########
@@ -356,13 +367,16 @@ protected String translateLike(RexNode like) {
       terms = translateLikeTermToSolrSyntax(terms, escapeChar);
 
       if (!terms.startsWith("(") && !terms.startsWith("[") && !terms.startsWith("{")) {
-        terms = escapeWithWildcard(terms);
+        String solrFieldType = solrFieldTypes.get(pair.getKey()).getType();
+        terms = escapeWithWildcard(terms, solrFieldType);
 
         // if terms contains multiple words and one or more wildcard chars, then we need to employ
         // the complexphrase parser
         // but that expects the terms wrapped in double-quotes, not parens
         boolean hasMultipleTerms = terms.split("\\s+").length > 1;
-        if (hasMultipleTerms && (terms.contains("*") || terms.contains("?"))) {
+        if (solrFieldType.equals("text")
+            && hasMultipleTerms

Review Comment:
   Let's think about the order we want these checks, I think there primitive Boolean probably should be first. And then reverse the check to be "text".equals to be better about null handling. 



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org