Skip to content

Commit

Permalink
VCST-1454: add relevance score to CustomerOrder (#433)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleg Zhuk <[email protected]>
  • Loading branch information
ksavosteev and OlegoO authored Sep 27, 2024
1 parent 843e2f0 commit da05d27
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/VirtoCommerce.OrdersModule.Core/Model/CustomerOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
using VirtoCommerce.Platform.Core.Common;
using VirtoCommerce.Platform.Core.Domain;
using VirtoCommerce.Platform.Core.Security;
using VirtoCommerce.SearchModule.Core.Model;

namespace VirtoCommerce.OrdersModule.Core.Model
{
public class CustomerOrder : OrderOperation, IHasTaxDetalization, ISupportSecurityScopes, ITaxable, IHasLanguage, IHasDiscounts, ICloneable, IHasFeesDetalization
public class CustomerOrder : OrderOperation, IHasTaxDetalization, ISupportSecurityScopes, ITaxable, IHasLanguage, IHasDiscounts, ICloneable, IHasFeesDetalization, IHasRelevanceScore
{
public byte[] RowVersion { get; set; }

Expand Down Expand Up @@ -65,6 +66,8 @@ public class CustomerOrder : OrderOperation, IHasTaxDetalization, ISupportSecuri

public ICollection<FeeDetail> FeeDetails { get; set; }

public double? RelevanceScore { get; set; }

#region IHasDiscounts
public ICollection<Discount> Discounts { get; set; }
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.ShippingModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.StoreModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.SearchModule.Core" Version="3.803.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using VirtoCommerce.Platform.Core.Common;
using VirtoCommerce.Platform.Core.Settings;
using VirtoCommerce.SearchModule.Core.Exceptions;
using VirtoCommerce.SearchModule.Core.Extensions;
using VirtoCommerce.SearchModule.Core.Model;
using VirtoCommerce.SearchModule.Core.Services;

Expand Down Expand Up @@ -89,7 +90,17 @@ protected virtual async Task<IList<CustomerOrder>> ConvertDocumentsAsync(IList<S

// Preserve documents order
var orders = documents
.Select(x => itemsMap.TryGetValue(x.Id, out var item) ? item : null)
.Select(doc =>
{
var order = itemsMap.TryGetValue(doc.Id, out var value) ? value : null;

if (order != null)
{
order.RelevanceScore = doc.GetRelevanceScore();
}

return order;
})
.Where(x => x != null)
.ToArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.InventoryModule.Core" Version="3.800.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.Platform.Hangfire" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.Platform.Security" Version="3.851.0" />
<PackageReference Include="VirtoCommerce.SearchModule.Data" Version="3.800.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.OrdersModule.Core\VirtoCommerce.OrdersModule.Core.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.OrdersModule.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<dependency id="VirtoCommerce.Inventory" version="3.800.0" />
<dependency id="VirtoCommerce.Notifications" version="3.800.0" />
<dependency id="VirtoCommerce.Payment" version="3.800.0" />
<dependency id="VirtoCommerce.Search" version="3.800.0" />
<dependency id="VirtoCommerce.Search" version="3.803.0" />
<dependency id="VirtoCommerce.Shipping" version="3.800.0" />
<dependency id="VirtoCommerce.Store" version="3.800.0" />
</dependencies>
Expand Down

0 comments on commit da05d27

Please sign in to comment.