alessandrobenedetti commented on a change in pull request #129:
URL: https://github.com/apache/solr/pull/129#discussion_r644684545
##########
File path:
solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
##########
@@ -1771,6 +1775,35 @@ public void testSplitOnWhitespace_Basic() throws
Exception {
assertThat(parsedquery, anyOf(containsString("((name:stigma |
title:stigma))"), containsString("((title:stigma | name:stigma))")));
}
+ @Test
+ public void testQf_stringFieldWithSowFalse_shouldBuildSingleQueryClause()
throws Exception
+ {
+ assertJQ(req("qf", "trait_ss", "defType", "edismax", "q", "multi
term", "sow", "false"),
+ "/response/numFound==1", "/response/docs/[0]/id=='75'");
+
+ String parsedquery = getParsedQuery(
+ req("qf", "trait_ss", "q", "multi term", "defType", "edismax",
"sow", "false", "debugQuery", "true"));
+ assertThat(parsedquery, anyOf(containsString("((trait_ss:multi
term))")));
Review comment:
Done!
##########
File path:
solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
##########
@@ -1771,6 +1775,35 @@ public void testSplitOnWhitespace_Basic() throws
Exception {
assertThat(parsedquery, anyOf(containsString("((name:stigma |
title:stigma))"), containsString("((title:stigma | name:stigma))")));
}
+ @Test
+ public void testQf_stringFieldWithSowFalse_shouldBuildSingleQueryClause()
throws Exception
+ {
+ assertJQ(req("qf", "trait_ss", "defType", "edismax", "q", "multi
term", "sow", "false"),
+ "/response/numFound==1", "/response/docs/[0]/id=='75'");
+
+ String parsedquery = getParsedQuery(
+ req("qf", "trait_ss", "q", "multi term", "defType", "edismax",
"sow", "false", "debugQuery", "true"));
+ assertThat(parsedquery, anyOf(containsString("((trait_ss:multi
term))")));
+ }
+
+ @Test
+ public void
testQf_numericField_shouldBuildMultipleQueryClausesIndependentlyOfSow() throws
Exception
+ {
+ assertJQ(req("qf", "foo_i", "defType", "edismax", "q", "101 102",
"sow", "false"),
+ "/response/numFound==2", "/response/docs/[0]/id=='76'",
"/response/docs/[1]/id=='77'");
+
+ String parsedquery = getParsedQuery(
+ req("qf", "foo_i", "q", "101 102", "defType", "edismax", "sow",
"false", "debugQuery", "true"));
+ assertThat(parsedquery, anyOf(containsString("foo_i:[101 TO 101]"),
containsString("foo_i:[102 TO 102]")));
Review comment:
you are right, fixed!
##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1149,18 +1151,21 @@ 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){
Review comment:
Should we then start a much more complex task i.e. "removal of StrField"
to avoid such inconsistencies?
We could try doing it in a back-compatible way, but ultimately I think the
real issue is that we express text to be untokenized in the index in two ways
with no apparent benefit but just inconsistencies ?
##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1149,18 +1151,21 @@ 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){
Review comment:
Should we then start a much more complex task i.e. "removal of StrField"
to avoid such inconsistencies?
We could try doing it in a back-compatible way, but ultimately I think the
real issue is that we express text to be untokenized in the index in two ways
with no apparent benefit but just inconsistencies ?
i.e.
StrField could be an alias rather than a separate Field Type
--
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]