Github user alessandrobenedetti commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/482#discussion_r227464824
  
    --- Diff: 
lucene/core/src/test/org/apache/lucene/analysis/TestStopFilter.java ---
    @@ -111,20 +119,24 @@ public void testEndStopword() throws Exception {
                                   null);
       }
     
    -  private void doTestStopPositons(StopFilter stpf) throws IOException {
    -    CharTermAttribute termAtt = stpf.getAttribute(CharTermAttribute.class);
    -    PositionIncrementAttribute posIncrAtt = 
stpf.getAttribute(PositionIncrementAttribute.class);
    -    stpf.reset();
    -    for (int i=0; i<20; i+=3) {
    -      assertTrue(stpf.incrementToken());
    -      log("Token "+i+": "+stpf);
    -      String w = English.intToEnglish(i).trim();
    -      assertEquals("expecting token "+i+" to be "+w,w,termAtt.toString());
    -      assertEquals("all but first token must have position increment of 
3",i==0?1:3,posIncrAtt.getPositionIncrement());
    +  private void doTestStopwordsPositions(StopFilter stopfilter) throws 
IOException {
    +    final int NUMBER_OF_TOKENS = 20;
    +    final int DELTA = 3;
    --- End diff --
    
    Given the fact that this was in the original code, and you just refactored, 
I don't like that much the fact that Delta=3 here is not a method parameter.
    In fact I doubt this method is really usable if the stop filter you pass is 
not precisely "all but divisible by 3" stop filter.
    I would make this method parametric to make it clearly related the 
numerical nature of the stop filter in input


---

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

Reply via email to