Skip to content

Commit

Permalink
VCST-541: Added CertainDate filter (#721)
Browse files Browse the repository at this point in the history
feat: Added CertainDate Filter for ProductIndexedSearchCriteria that allows to filter products that are enabled on the specific date.
  • Loading branch information
OlegoO committed Mar 18, 2024
1 parent 3c61b51 commit 132762d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public class ProductIndexedSearchCriteria : CatalogIndexedSearchCriteria
/// <value>The end date.</value>
public virtual DateTime? EndDate { get; set; }

/// <summary>
/// Defines the date to be used for filtering products. The date must be in UTC format as that is format indexes are stored in.
/// </summary>
public DateTime? CertainDate { get; set; }

/// <summary>
/// Gets or sets a "white" list of aggregation keys that identify preconfigured aggregations, which SHOULD be calculated and returned with the search result.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ protected virtual IList<IFilter> GetPermanentFilters(ProductIndexedSearchCriteri

result.Add(FiltersHelper.CreateOutlineFilter(criteria));

if (criteria.CertainDate.HasValue)
{
result.Add(FiltersHelper.CreateDateRangeFilter("startdate", null, criteria.CertainDate, false, true));
result.Add(FiltersHelper.CreateDateRangeFilter("enddate", criteria.CertainDate, null, false, true));
}

if (criteria.StartDateFrom.HasValue)
{
result.Add(FiltersHelper.CreateDateRangeFilter("startdate", criteria.StartDateFrom, criteria.StartDate, false, true));
Expand Down

0 comments on commit 132762d

Please sign in to comment.