dsmiley commented on a change in pull request #158:
URL: https://github.com/apache/solr/pull/158#discussion_r643958682
##########
File path:
solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
##########
@@ -1776,6 +1764,36 @@ private static String getParsedQuery(SolrQueryRequest
request) throws Exception
return (String) BaseTestHarness.evaluateXPath(resp,
"//str[@name='parsedquery']/text()", XPathConstants.STRING);
}
+ public void testSplitOnWhitespace_shouldRespectMinimumShouldMatch(){
Review comment:
The indentation here is inconsistent. Please configure your IDE so that
this simply doesn't happen.
##########
File path: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java
##########
@@ -1159,8 +1160,13 @@ protected Query getFieldQuery(String field, List<String>
queryTerms, boolean raw
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) {
+ /*
Review comment:
Minor: carriage returns is making this look ugly. I'd prefer all this
be on 2-3 lines, and using "//"
##########
File path:
solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
##########
@@ -1776,6 +1764,36 @@ private static String getParsedQuery(SolrQueryRequest
request) throws Exception
return (String) BaseTestHarness.evaluateXPath(resp,
"//str[@name='parsedquery']/text()", XPathConstants.STRING);
}
+ public void testSplitOnWhitespace_shouldRespectMinimumShouldMatch(){
+ String oner = "*[count(//doc)=1]";
+ String nor = "*[count(//doc)=0]";
+ /*
+ * in multi-field search with different analysis per field
+ * sow=true causes the minimum should match to be "per document"
+ * i.e a document to be a match must contain all the mm query terms
anywhere at least once
+ * sow=false causes the minimum should match to be "per field"
+ * i.e a document to be a match must contain all the mm query terms in
a single field at least once
+ * See https://issues.apache.org/jira/browse/SOLR-12779 for
additional details
+ */
+ assertQ(req("defType","edismax", "mm","100%", "q","Terminator: 100",
"qf","movies_t foo_i", "sow","true"),
+ nor); //no document contains both terms, in a field or in multiple
field
+
+ assertQ(req("defType","edismax", "mm","100%", "q","Terminator: 100",
"qf","movies_t foo_i", "sow","false"),
+ nor); //no document contains both terms in a field
+ assertQ(req("defType","edismax", "mm","100%", "q","Terminator: 100",
"qf","movies_t foo_i"), // default sow=false
Review comment:
I'd drop this assertion; there is no distinction
--
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]