alessandrobenedetti commented on a change in pull request #129:
URL: https://github.com/apache/solr/pull/129#discussion_r638118658
##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1149,18 +1151,26 @@ protected Query getFieldQuery(String field,
List<String> queryTerms, boolean raw
return newFieldQuery
(getAnalyzer(), field, queryText, false,
fieldAutoGenPhraseQueries, fieldEnableGraphQueries, synonymQueryStyle);
} else {
- if (raw) {
+ if (raw) {// assumption: raw = false only when called from
ExtendedDismaxQueryParser.getQuery()
return new RawQuery(sf, queryTerms);
} else {
if (queryTerms.size() == 1) {
return ft.getFieldQuery(parser, sf, queryTerms.get(0));
+ } else if(ft instanceof StrField){
+ String queryText = String.join(" ", queryTerms);
+ return ft.getFieldQuery(parser, sf, queryText);
} else {
List<Query> subqs = new ArrayList<>();
for (String queryTerm : queryTerms) {
try {
subqs.add(ft.getFieldQuery(parser, sf, queryTerm));
- } catch (Exception e) { // assumption: raw = false only when
called from ExtendedDismaxQueryParser.getQuery()
- // for edismax: ignore parsing failures
+ } catch (Exception e) {
+ /*
+ This happens when a field tries to parse a query term of
incompatible type
+ e.g.
+ a numerical field trying to parse a textual query term
+ */
+ subqs.add(new MatchNoDocsQuery(queryTerm + " is not compatible
with " + field));
Review comment:
The effect is in relation to the Minimum Should Match and sow, and the
consequent bug detailed in thia Jira issue, it's not strictly related to the
split on whitespace and strings, ideally two pull requests would be better, let
me know and in case I can split the changes
--
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]