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

    https://github.com/apache/lucenenet/pull/176#discussion_r73793556
  
    --- Diff: src/Lucene.Net.Core/Util/ToStringUtils.cs ---
    @@ -36,12 +37,13 @@ public static string Boost(float boost)
             {
                 if (boost != 1.0f)
                 {
    -                return "^" + Convert.ToString(boost);
    +                float boostAsLong = (long)boost;
    +                if (boostAsLong == boost)
    +                    return "^" + 
boost.ToString(".0").Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
 ".");
    +                return "^" + 
boost.ToString().Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
 ".");
    --- End diff --
    
    I copied it over verbatim from Lucene.Net 3.0.3. The previous code was 
chopping off the .0 on the end, which was different behavior than what was 
expected by the tests. This was necessary to make some of the tests pass.
    
    For example, 
    
    ```
    Test Name:  TestSimple
    Test FullName:      
Lucene.Net.QueryParser.Classic.TestMultiFieldQueryParser.TestSimple
    Test Source:        
F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Classic\TestMultiFieldQueryParser.cs
 : line 70
    Test Outcome:       Failed
    Test Duration:      0:00:00.003
    
    Result StackTrace:  
    at Lucene.Net.Util.LuceneTestCase.assertEquals(Object expected, Object 
actual) in 
F:\Projects\lucenenet\src\Lucene.Net.TestFramework\JavaCompatibility\LuceneTestCase.cs:line
 31
    at Lucene.Net.QueryParser.Classic.TestMultiFieldQueryParser.TestSimple() in 
F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Classic\TestMultiFieldQueryParser.cs:line
 87
    Result Message:     
    Expected string length 33 but was 31. Strings differ at index 16.
      Expected: "((b:one t:one)^2.0) (b:two t:two)"
      But was:  "((b:one t:one)^2) (b:two t:two)"
      ---------------------------^
      ```
    And
    ```
    Test Name:  TestRange
    Test FullName:      
Lucene.Net.QueryParser.Util.QueryParserTestBase.TestRange
    Test Source:        
F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Util\QueryParserTestBase.cs
 : line 657
    Test Outcome:       Failed
    Test Duration:      0:00:00.003
    
    Result StackTrace:  
    at Lucene.Net.Util.LuceneTestCase.fail(String message) in 
F:\Projects\lucenenet\src\Lucene.Net.TestFramework\JavaCompatibility\LuceneTestCase.cs:line
 120
    at Lucene.Net.QueryParser.Util.QueryParserTestBase.AssertQueryEquals(String 
query, Analyzer a, String result) in 
F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Util\QueryParserTestBase.cs:line
 204
    at Lucene.Net.QueryParser.Util.QueryParserTestBase.TestRange() in 
F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Util\QueryParserTestBase.cs:line
 683
    Result Message:     Query /{ a TO z }^2.0/ yielded /{a TO z}^2/, expecting 
/{a TO z}^2.0/
    ```
    
    Admittedly the code looks bad, but it worked in the prior version and was 
exactly what was needed to make these (and other) tests green.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to