mirror of https://github.com/apache/lucene.git
This reverts the addition of spotless:on/off regions and shows just one possible alternative that is formatter fool-proof. (#13098)
This commit is contained in:
parent
2639aea5dd
commit
a270acae01
|
@ -28,7 +28,6 @@ configure(project(":lucene").subprojects) { prj ->
|
|||
|
||||
spotless {
|
||||
java {
|
||||
toggleOffOn() // obviously, only to be used sparingly.
|
||||
// TODO: Work out how to support multiple different header files (we have
|
||||
// classes in the codebase that have original headers). We currently use
|
||||
// Apache RAT to enforce headers so this is of lesser priority.
|
||||
|
|
|
@ -269,10 +269,11 @@ public class TestPayloadCheckQuery extends LuceneTestCase {
|
|||
MatchOperation.GT);
|
||||
checkHits(
|
||||
stringGT2,
|
||||
new int[] { // spotless:off
|
||||
155, 255, 355, 455, 555, 655, 755, 855, 955,
|
||||
1055, 1155, 1255, 1355, 1455, 1555, 1655, 1755, 1855, 1955
|
||||
}); // spotless:on
|
||||
alignedIntArray(
|
||||
"""
|
||||
155, 255, 355, 455, 555, 655, 755, 855, 955,
|
||||
1055, 1155, 1255, 1355, 1455, 1555, 1655, 1755, 1855, 1955
|
||||
"""));
|
||||
SpanQuery stringGTE2 =
|
||||
new SpanPayloadCheckQuery(
|
||||
new SpanNearQuery(new SpanQuery[] {termFifty, termFive}, 0, true),
|
||||
|
@ -281,10 +282,11 @@ public class TestPayloadCheckQuery extends LuceneTestCase {
|
|||
MatchOperation.GTE);
|
||||
checkHits(
|
||||
stringGTE2,
|
||||
new int[] { // spotless:off
|
||||
55, 155, 255, 355, 455, 555, 655, 755, 855, 955,
|
||||
1055, 1155, 1255, 1355, 1455, 1555, 1655, 1755, 1855, 1955
|
||||
}); // spotless:on
|
||||
alignedIntArray(
|
||||
"""
|
||||
55, 155, 255, 355, 455, 555, 655, 755, 855, 955,
|
||||
1055, 1155, 1255, 1355, 1455, 1555, 1655, 1755, 1855, 1955
|
||||
"""));
|
||||
|
||||
SpanQuery stringLT2 =
|
||||
new SpanPayloadCheckQuery(
|
||||
|
@ -306,6 +308,23 @@ public class TestPayloadCheckQuery extends LuceneTestCase {
|
|||
// sets "upto" back to zero between SpanOrQuery subclauses.
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a comma-separated array of integers, ignoring white space around them. This allows for
|
||||
* arbitrary alignment of integers in the source string to convey additional information about
|
||||
* their mutual relations. For example:
|
||||
*
|
||||
* <pre>{@code
|
||||
* var ints =
|
||||
* """
|
||||
* 1, 2, 3,
|
||||
* 11, 12, 13
|
||||
* """
|
||||
* }</pre>
|
||||
*/
|
||||
private static int[] alignedIntArray(String ints) {
|
||||
return Arrays.stream(ints.split(",")).map(String::trim).mapToInt(Integer::parseInt).toArray();
|
||||
}
|
||||
|
||||
public void testUnorderedPayloadChecks() throws Exception {
|
||||
|
||||
SpanTermQuery term5 = new SpanTermQuery(new Term("field", "five"));
|
||||
|
|
Loading…
Reference in New Issue