anshumg commented on code in PR #5394:
URL: https://github.com/apache/solr/pull/5394#discussion_r4735638864
##########
solr/core/src/test/org/apache/solr/schema/TestOmitPositions.java:
##########
@@ -54,20 +54,52 @@ public void testFrequencies() {
"//result/doc[2]/str[@name='id'][.=1]");
}
- @SuppressWarnings("try")
- public void testPositions() {
- // no results should be found:
- // lucene 3.x: silent failure
- // lucene 4.x: illegal state exception, field was indexed without positions
+ /**
+ * An explicit phrase against a field indexed without positions is a
client/schema mismatch, not a
+ * server fault: it must be rejected with 400.
+ */
+ public void testExplicitPhraseIsBadRequest() {
+ assertQEx(
+ "lucene parser: explicit phrase on omitPositions field",
+ req("fl", "id", "q", "nopositionstext:\"test test\""),
+ SolrException.ErrorCode.BAD_REQUEST);
+ assertQEx(
+ "edismax: explicit phrase via qf on omitPositions field",
+ req("fl", "id", "defType", "edismax", "qf", "nopositionstext", "q",
"\"test test\""),
+ SolrException.ErrorCode.BAD_REQUEST);
+ }
- try (ErrorLogMuter ignored = ErrorLogMuter.regex("was indexed without
position data")) {
+ /**
+ * pf/pf2/pf3 are implicit, best-effort boosts the user never typed. A
phrase field that cannot
Review Comment:
A part of me agree is with you but we have users who aren't necessarily
'search developers'.
I'm ok with this just being something that handles the 500->400 for standard
phrase queries and drop the 2nd commit if you feel strongly about it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]