xristy commented on issue #536: Add support SurroundQueryParser to jena-text
URL: https://github.com/apache/jena/pull/536#issuecomment-478257773
 
 
   The switch seems not correct yet:
   
   >             case "AnalyzingQueryParser":
   >                 if (qp == null) qp = new 
QueryParser(docDef.getPrimaryField(), analyzer);
   >             case "QueryParser":
   >                 if (qp == null) {
   >                     log.warn("Deprecated query parser type '" + 
queryParserType + "'. Defaulting to standard QueryParser");
   >                     qp = new QueryParser(docDef.getPrimaryField(), 
analyzer);
   >                 }
   >             default:
   >                 if(qp  == null) {
   >                     log.warn("Unknown query parser type '" + 
queryParserType + "'. Defaulting to standard QueryParser") ;
   >                     qp = new QueryParser(docDef.getPrimaryField(), 
analyzer);
   >                 }
   >                 qp.setAllowLeadingWildcard(true);
   >                 query = qp.parse(queryString);
   >         }
   >         return query ;
   >     }
   
   
   It should be more like:
   
               case "AnalyzingQueryParser":
                   if (qp == null) {
                      log.warn("Deprecated query parser type '" + 
queryParserType + "'. Defaulting to standard QueryParser");
                   }
               case "QueryParser":
                   if (qp == null) {
                       qp = new QueryParser(docDef.getPrimaryField(), analyzer);
                   }
               default:
                   if (qp  == null) {
                       log.warn("Unknown query parser type '" + queryParserType 
+ "'. Defaulting to standard QueryParser") ;
                       qp = new QueryParser(docDef.getPrimaryField(), analyzer);
                   }
                   qp.setAllowLeadingWildcard(true);
                   query = qp.parse(queryString);
           }
           return query ;
       }
   
   otherwise the `log.warn` fires, incorrectly, for the `case "QueryParser"` 
and `qp` is redundantly assigned for `case "AnalyzingQueryParser"`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to