You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/05/20 07:16:56 UTC

[GitHub] [lucene] glawson0 commented on a change in pull request #146: LUCENE-9963 Add tests for alternate path failures in FlattenGraphFilter

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



##########
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:
       A randomized test should be possible. We could build a random valid graph and try to flatten it. Checking offsets/length/increment would be difficult because the FlattenGraphFilter does change those as the graph gets "sausage-ized". You would have to know what tokens end up as edges between the same nodes in the final graph and what order they'ed be in.
   
   An easy way to do this might be to start with a closed set of tokens, create a synonym dictionary dictionary with some random relations, pick some of the tokens to be stop words, add FlattenGraphFilter at the end, then generate some strings from your tokens and send them through.




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



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