Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Have you checked that the birthday is indexed? Use the Find UI, or InspectInIndex.
SearchClient.Instance.Search<PersonProfilePage>()
.Filter(x=> x.BirthDay.Match("09/17"))
.Take(1000)
.GetContentResult();
If the birtday is indexed, try simplifiing your query as above.
Thanks Tomas. The field was marked to exclude from indexing. After including it I can see the results.
Also is it the right way to get the info or any other preferred way in my scenario.
Hello,
I have a page type that stores users birthday in mm/dd format as a string. There is no year.
I have a requirement to show the pages of the users who have their birthday today. I was wondering how would I go query for this since the stored birthday is not in Datetime format how can I split the value and match month and day with todays month and day.
I tried this but I cant get any match.
var query = _client.Search<IContent>();
var toSearch = DateTime.Today.Month.ToString("00") + "/" + DateTime.Today.Day.ToString("00");
var bdayFilter = _client.BuildFilter<PersonProfilePage>();
bdayFilter = bdayFilter.And(x => x.BirthDay.Match(toSearch));
var result = query
.Filter(x => x.MatchType(typeof(PersonProfilePage)))
.Filter(bdayFilter)
.Take(1000)
.GetContentResult();