msokolov commented on a change in pull request #146:
URL: https://github.com/apache/lucene/pull/146#discussion_r635290159



##########
File path: 
lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestFlattenGraphFilter.java
##########
@@ -314,5 +314,116 @@ public void testTwoLongParallelPaths() throws Exception {
         11);
   }
 
+  // The end node the long path is supposed to flatten over doesn't exist
+  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-9963";)
+  public void testAltPathFirstStepHole() throws Exception {
+    TokenStream in =
+        new CannedTokenStream(
+            0,
+            3,
+            new Token[] {token("abc", 1, 3, 0, 3), token("b", 1, 1, 1, 2), 
token("c", 1, 1, 2, 3)});
+
+    TokenStream out = new FlattenGraphFilter(in);
+
+    assertTokenStreamContents(

Review comment:
       I'm curious to know what happens currently - how does the test fail? 
Could you maybe add a comment saying what the bad results are in each of these 
cases? Hmm I see you did in some cases below.
   
   This stuff is crazy? TBH I am not all that familiar with how 
FlattenGraphFilter works, but I wonder if we could express some invariants 
cleanly and write a randomized test? There seem to be a lot of different edge 
cases.

##########
File path: 
lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestFlattenGraphFilter.java
##########
@@ -314,5 +314,116 @@ public void testTwoLongParallelPaths() throws Exception {
         11);
   }
 
+  // The end node the long path is supposed to flatten over doesn't exist
+  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/LUCENE-9963";)
+  public void testAltPathFirstStepHole() throws Exception {
+    TokenStream in =
+        new CannedTokenStream(
+            0,
+            3,
+            new Token[] {token("abc", 1, 3, 0, 3), token("b", 1, 1, 1, 2), 
token("c", 1, 1, 2, 3)});
+
+    TokenStream out = new FlattenGraphFilter(in);
+
+    assertTokenStreamContents(
+        out,
+        new String[] {"abc", "b", "c"},
+        new int[] {0, 1, 2},
+        new int[] {3, 2, 3},
+        new int[] {1, 1, 1},
+        new int[] {3, 1, 1},
+        3);
+  }
+  // Last node in an alt path releases the long path. but it doesn't exist in 
this graph

Review comment:
       nit: add a blank line




-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to