Skip to content

Commit

Permalink
Version v0.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
oruchreis committed Oct 28, 2024
1 parent 808eb12 commit 1365e4b
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 40 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.5] - 2024-06-04
## [0.4.7] - 2024-06-04
### Changed
- Updated Reindexer Embedded to 3.29

## [0.4.6] - 2024-06-04
### Fixed
- CJson Sort method (Thanks to @DFSko)

Expand Down
29 changes: 23 additions & 6 deletions Tests/ReindexerNet.CoreTest/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,14 @@ public async Task QueryBuilderTest()
Assert.AreEqual(2 * 0.125, item.RangeIndex);
CollectionAssert.AreEqual(Enumerable.Range(0, 2).Select(r => (byte)(r % 255)).ToArray(), item.Payload);

var singleSortedDocs = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.Where("Id", Condition.LT, 1000).Sort("Id", false));
CollectionAssert.AreEqual(insertedItems.Where(i => i.Id < 1000).OrderByDescending(i => i.Id).Select(i => i.Id).ToList(), singleSortedDocs.Items.Select(i => i.Id).ToList());

var multiSortedDocs = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.Where("Id", Condition.LT, 1000).Sort("Group", false).Sort("Id", false));
CollectionAssert.AreEqual(insertedItems.Where(i => i.Id < 1000).OrderByDescending(i => i.Group).ThenByDescending(i => i.Id).Select(i => i.Id).ToList(), multiSortedDocs.Items.Select(i => i.Id).ToList());

var arrayItems = Enumerable.Range(0, 500).Select(i => $"..{i}..").ToArray();
var arrayContainsDocs = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.WhereString("ArrayIndex", Condition.ALLSET, arrayItems));
Expand Down Expand Up @@ -371,28 +379,37 @@ public async Task QueryBuilderTest()
Assert.AreEqual(1, aggregateSumAvgQuery.Aggregations.Count(ag => ag.Type == "sum"));
Assert.AreEqual(1, aggregateSumAvgQuery.Aggregations.Count(ag => ag.Type == "avg"));
Assert.AreEqual(docs.Items.Select(e => e.Group).Sum(), aggregateSumAvgQuery.Aggregations.First(ag => ag.Type == "sum").Value);
Assert.AreEqual(((decimal)docs.Items.Select(e => e.Group).Sum()/docs.Items.Count).ToString("0.####"), aggregateSumAvgQuery.Aggregations.First(ag => ag.Type == "avg").Value.Value.ToString("0.####"));
Assert.AreEqual(((decimal)docs.Items.Select(e => e.Group).Sum() / docs.Items.Count).ToString("0.####"), aggregateSumAvgQuery.Aggregations.First(ag => ag.Type == "avg").Value.Value.ToString("0.####"));

var aggregateDistictQuery = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.Distinct("Group"));
Assert.AreEqual(1, aggregateDistictQuery.Aggregations.Count(ag => ag.Type == "distinct"));
CollectionAssert.AreEquivalent(new string[]{ "0", "1", "2" }, aggregateDistictQuery.Aggregations.First(ag => ag.Type == "distinct").Distincts);
CollectionAssert.AreEquivalent(new string[] { "0", "1", "2" }, aggregateDistictQuery.Aggregations.First(ag => ag.Type == "distinct").Distincts);


var aggregateFacetQuery = await Client.ExecuteAsync<TestDocument>(NsName,
q => q
.WhereString("ArrayIndex", Condition.SET, Enumerable.Range(1,100).Select(i => $"..{i}..").ToArray())
.AggregateFacet(fq =>
.WhereString("ArrayIndex", Condition.SET, Enumerable.Range(1, 100).Select(i => $"..{i}..").ToArray())
.AggregateFacet(fq =>
fq.Sort("Group", true).Limit(2),
"Group"));
Assert.AreEqual(1, aggregateFacetQuery.Aggregations.Count(ag => ag.Type == "facet" && ag.Fields.SequenceEqual(["Group"])));
Assert.AreEqual(2, aggregateFacetQuery.Aggregations.First(ag => ag.Type == "facet" && ag.Fields.SequenceEqual(["Group"])).Facets.Count);
CollectionAssert.AreEquivalent(new string[]{ "2" }, aggregateFacetQuery.Aggregations.First(ag => ag.Type == "facet" && ag.Fields.SequenceEqual(["Group"])).Facets.First().Values);
CollectionAssert.AreEquivalent(new string[] { "2" }, aggregateFacetQuery.Aggregations.First(ag => ag.Type == "facet" && ag.Fields.SequenceEqual(["Group"])).Facets.First().Values);

var joinQuery = await Client.ExecuteAsync<TestDocument>(NsName,
var joinQuery = await Client.ExecuteAsync<TestDocument>(NsName,
q => q.Limit(10).LeftJoin(NsName, j => j.Limit(1), "JoinedByGroup").On(nameof(TestDocument.Group), Condition.EQ, nameof(TestDocument.Group))
);
Assert.AreEqual(10, joinQuery.QueryTotalItems);


var aggregateMultipleWhereQuery = await Client.ExecuteAsync<TestDocument>(NsName,
q => q
.Where(q1 => q1.WhereString("ArrayIndex", Condition.SET, Enumerable.Range(1, 100).Select(i => $"..{i}..").ToArray()))
.Where(q2 => q2.WhereDouble("RangeIndex", Condition.GT, 50))
.AggregateFacet(fq =>
fq.Sort("Group", true).Limit(2),
"Group"));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="BenchmarkDotNet" Version="0.13.11" />
<PackageReference Include="Cachalot.Client" Version="2.0.8" />
<PackageReference Include="LiteDB" Version="5.0.17" />
<PackageReference Include="MessagePack" Version="2.5.140" />
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Realm" Version="11.6.1" />
<PackageReference Include="SpanJson" Version="4.0.1" />
</ItemGroup>
Expand Down
15 changes: 8 additions & 7 deletions src/ReindexerNet.Core/ReindexerNet.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
<Title>ReindexerNet.Core</Title>
<Description>ReindexerNet.Core includes rest api models for Reindexer and includes base interfaces for ReindexerNet.</Description>
<PackageTags>reindexer embedded document-db in-memory</PackageTags>
<Version>0.4.6</Version>
<AssemblyVersion>0.4.6</AssemblyVersion>
<FileVersion>0.4.6</FileVersion>
<Version>0.4.7</Version>
<AssemblyVersion>0.4.7</AssemblyVersion>
<FileVersion>0.4.7</FileVersion>
</PropertyGroup>

<ItemGroup>
<Compile Remove="CJsonSerializer.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.0" Condition="'$(TargetFramework)'=='net8.0'" />
<PackageReference Include="System.Text.Json" Version="7.0.0" Condition="'$(TargetFramework)'=='net7.0'" />
<PackageReference Include="System.Text.Json" Version="6.0.0" Condition="'$(TargetFramework)'=='net6.0'" />
<PackageReference Include="System.Text.Json" Version="5.0.0" Condition="'$(TargetFramework)'!='net8.0' and '$(TargetFramework)'!='net7.0' and '$(TargetFramework)'!='net6.0'" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
<Title>ReindexerNet.Embedded</Title>
<Description>Reindexer Embedded library to embed and run in .net projects.</Description>
<PackageTags>reindexer embedded document-db in-memory</PackageTags>
<Version>0.4.5.3200</Version>
<AssemblyVersion>0.4.5</AssemblyVersion>
<FileVersion>0.4.5</FileVersion>
<Version>0.4.7.3290</Version>
<AssemblyVersion>0.4.7</AssemblyVersion>
<FileVersion>0.4.7</FileVersion>
</PropertyGroup>

<ItemGroup>
<Content Include="runtimes\**\*" CopyToOutputDirectory="PreserveNewest" Pack="true" PackagePath="runtimes" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
<Title>ReindexerNet.Embedded</Title>
<Description>Reindexer Embedded library to embed and run in .net projects.</Description>
<PackageTags>reindexer embedded document-db in-memory</PackageTags>
<Version>0.4.5.3200</Version>
<AssemblyVersion>0.4.5</AssemblyVersion>
<FileVersion>0.4.5</FileVersion>
<Version>0.4.7.3290</Version>
<AssemblyVersion>0.4.7</AssemblyVersion>
<FileVersion>0.4.7</FileVersion>
</PropertyGroup>

<ItemGroup>
<Content Include="runtimes\**\*" CopyToOutputDirectory="PreserveNewest" Pack="true" PackagePath="runtimes" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>

</Project>
Loading

0 comments on commit 1365e4b

Please sign in to comment.