Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
I adapted my approach for this. Firstly I realised I only cared about Month and Year but I still had the same problem. So for anyone else the steps I did were
public static ITypeSearch<T> FilterMonths<T>(this ITypeSearch<T> query, List<DateTime> filterDates)
where T : IContent, IEventContent
{
if (filterDates != null && filterDates.Any())
{
var dateFilter = SearchClient.Instance.BuildFilter<T>();
var minDate = filterDates.Min();
var maxDate = filterDates.Max();
var datesInRange = minDate.GetDateMonthRangeFloored(maxDate);
foreach (var dateTime in datesInRange)
{
var stringMatch = $"{dateTime.Year}-{dateTime.Month}";
dateFilter = dateFilter.Or(x => x.MonthRange.MatchContained(f => f.Key, stringMatch));
}
return query.Filter(dateFilter);
}
return query;
}
Hi guys using using find 13.2.7 I have trying to match if any passed in dates in a range exist within an indexed collection of date ranges for the index item
E.g I have index on my item with a field
And I'm trying to write an extension method that allows be to pass a list of dates and check if any of those exist in the list.
I created
But when I run thge query I get an error.
I've been using the match contained for another query which works as it's just a string but there's no matchcontained implementation for a DateTime Day,Month,Year match.
Does anyone good with Find know how to resolve this as I'm a bit rusty with my Find queries.