Try our conversational search powered by Generative AI!

No data coming from epifind query when start date and end date is same

Vote:
 

Hi ,

I have written epi find query where i have option to search data from start date to end date below is my query:-

SearchClient.Instance.Search().Filter(x => x.StartPublish.InRange(startdate, enddate)).

I am not getting any data when Start Date and End Date is same. Could any one help me please how to get data when Start date and end date are same.

Thanks

Sourav

#177672
Apr 17, 2017 14:14
Vote:
 

Having the same start date and end date should not be a problem, but it will require that the results have that exact DateTime - including matching hours and seconds. To solve this, you could do something like this:

.Filter(x => x.StartPublish.InRange(startDate.Date, endDate.AddDays(1).AddTicks(-1)))

This will make sure that you get all results with the current date.

You could also use MatchDay:

            if (endDate == startDate)
            {
                query = query.Filter(x => x.StartPublish.MatchDay(startDate.Year, startDate.Month, startDate.Day));
            }
            else
            {
                ...
            }
#177735
Apr 18, 2017 13:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.