NightOwl888 opened a new pull request #570:
URL: https://github.com/apache/lucenenet/pull/570


   Fixes #428, Fixes #429.
   
   This reverts `FieldComparer` to be closer to the Java implementation, which 
uses reference type wrappers for numeric value types so it is not so expensive 
to unbox them when placed in an `object[]` array.
   
   Note that the tests were all converted to use the fastest syntax to unbox 
the number:
   
   ```c#
   int value = (J2N.Numerics.Int32)objectWrapped; // Implicit conversion to 
System.Int32
   int value2 = ((J2N.Numerics.Number)objectWrapped2).ToInt32(); // Explicit 
conversion from unknown reference numeric type to Int32
   ```
   Although slower, using `Convert` methods are less verbose and more 
consistent:
   
   ```c#
   int value = Convert.ToInt32(objectWrapped); // objectWrapped2 is 
J2N.Numerics.Int32
   int value2 = Convert.ToInt32(objectWrapped2); // objectWrapped2 is unknown 
subclass of J2N.Numerics.Number
   ```
   
   There are also several other updates:
   
   - J2N parsers and formatters are used to convert to/from strings (these 
patch the broken floating point round tripping back to .NET Framework and 
change the default format to always include at least one place after the 
decimal point)
   - NumericRangeQuery<T> was also modified to eliminate boxing that was 
introduced by using `Convert.ToXXX` methods on generic value types.
   - Use `HasValue`/`Value` on nullable value types to reduce casting
   - Use `Nullable.Equals()` for comparing generic numeric types for equality
   - `Lucene.Net.Queries.ObjectVal` returns a `J2N.Numerics.Number`-derived 
type rather than a value type cast to `object`
   - **BREAKING:** `Lucene.Net.Search.FieldCache.IParser::TermsEnum()` Renamed 
method to `GetTermsEnum()` to match other APIs


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to