lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NightOwl888 <>
Subject [GitHub] lucenenet pull request #176: Ported QueryParser
Date Sat, 06 Aug 2016 23:37:08 GMT
Github user NightOwl888 commented on a diff in the pull request:
    --- 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
    at Lucene.Net.QueryParser.Classic.TestMultiFieldQueryParser.TestSimple() in F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Classic\TestMultiFieldQueryParser.cs:line
    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)"
    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 message) in F:\Projects\lucenenet\src\Lucene.Net.TestFramework\JavaCompatibility\LuceneTestCase.cs:line
    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
    at Lucene.Net.QueryParser.Util.QueryParserTestBase.TestRange() in F:\Projects\lucenenet\src\Lucene.Net.Tests.QueryParser\Util\QueryParserTestBase.cs:line
    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 or file a JIRA ticket
with INFRA.

View raw message