forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypedStatsResult and add unit test
- TypedStatsResult was changed to an interface so that the setter can be overridden. - TypedStatsResultDouble is no longer needed. - Add some unit tests.
- Loading branch information
1 parent
b916d57
commit 12f8b9b
Showing
9 changed files
with
225 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- https://cwiki.apache.org/confluence/display/solr/The+Stats+Component#TheStatsComponent-Example.1 --> | ||
<lst name="stats"> | ||
<lst name="stats_fields"> | ||
<lst name="instock_prices"> | ||
<double name="min">0.0</double> | ||
<double name="max">2199.0</double> | ||
<long name="count">16</long> | ||
<long name="missing">16</long> | ||
<double name="sum">5251.270030975342</double> | ||
<double name="sumOfSquares">6038619.175900028</double> | ||
<double name="mean">328.20437693595886</double> | ||
<double name="stddev">536.3536996709846</double> | ||
<lst name="facets"/> | ||
<lst name="stats_fields"> | ||
<lst name="instock_prices"> | ||
<double name="min">0.0</double> | ||
<double name="max">2199.0</double> | ||
<long name="count">16</long> | ||
<long name="missing">16</long> | ||
<double name="sum">5251.270030975342</double> | ||
<double name="sumOfSquares">6038619.175900028</double> | ||
<double name="mean">328.20437693595886</double> | ||
<double name="stddev">536.3536996709846</double> | ||
<lst name="facets"/> | ||
</lst> | ||
<lst name="all_prices"> | ||
<double name="min">0.0</double> | ||
<double name="max">2199.0</double> | ||
<long name="count">12</long> | ||
<long name="missing">5</long> | ||
<double name="sum">4089.880027770996</double> | ||
<double name="sumOfSquares">5385249.921747174</double> | ||
<double name="mean">340.823335647583</double> | ||
<double name="stddev">602.3683083752779</double> | ||
<lst name="facets"/> | ||
</lst> | ||
<lst name="dateField"> | ||
<date name="min">2013-12-20T00:00:00Z</date> | ||
<date name="max">2013-12-23T00:00:00Z</date> | ||
<long name="count">2</long> | ||
<long name="missing">70096</long> | ||
<date name="sum">2057-12-10T23:59:59.999Z</date> | ||
<date name="mean">2013-12-21T11:59:59.999Z</date> | ||
<double name="sumOfSquares">-1.6000595974543114E19</double> | ||
<double name="stddev">NaN</double> | ||
<lst name="facets"/> | ||
</lst> | ||
<lst name="stringField"> | ||
<str name="min">Test</str> | ||
<str name="max">Test string</str> | ||
<long name="count">277</long> | ||
<long name="missing">0</long> | ||
</lst> | ||
<lst name="nullField"> | ||
<null name="min"/> | ||
<null name="max"/> | ||
</lst> | ||
</lst> | ||
<lst name="all_prices"> | ||
<double name="min">0.0</double> | ||
<double name="max">2199.0</double> | ||
<long name="count">12</long> | ||
<long name="missing">5</long> | ||
<double name="sum">4089.880027770996</double> | ||
<double name="sumOfSquares">5385249.921747174</double> | ||
<double name="mean">340.823335647583</double> | ||
<double name="stddev">602.3683083752779</double> | ||
<lst name="facets"/> | ||
</lst> | ||
</lst> | ||
</lst> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace SolrNet | ||
{ | ||
/// <summary> | ||
/// ITypedStatsResult of a field. | ||
/// </summary> | ||
public interface ITypedStatsResult<out T> | ||
{ | ||
/// <summary> | ||
/// Minimum value | ||
/// </summary> | ||
T Min { get; } | ||
|
||
/// <summary> | ||
/// Maximum value | ||
/// </summary> | ||
T Max { get; } | ||
|
||
/// <summary> | ||
/// Sum of all values | ||
/// </summary> | ||
T Sum { get; } | ||
|
||
/// <summary> | ||
/// Sum of all values squared (useful for stddev) | ||
/// </summary> | ||
T SumOfSquares { get; } | ||
|
||
/// <summary> | ||
/// The average (v1+v2...+vN)/N | ||
/// </summary> | ||
T Mean { get; } | ||
|
||
/// <summary> | ||
/// Standard deviation | ||
/// </summary> | ||
T StdDev { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.