November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Ash,
Have you tried adding .FilterForVisitor() to your search query?
This should take care of this.
Can you please post your code snippet here?
I don't think this is required step but have you rebuilt the index after page expires.
return _searchClient.Search<ContentPageBase>(Language.English
.For(searchTerm)
.WithAndAsDefaultOperator()
.UsingAutoBoost(TimeSpan.FromDays(14))
.UsingSynonyms()
.FilterByExactTypes(new[] { typeof(HeritagePropertyLandingPage) })
.Filter(x => !x.MatchType(typeof(EventPage)) | (x as EventPage).End_Date.After(
new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59)))
.CurrentlyPublished()
.ExcludeDeleted()
.ExcludeContentFolders()
.PublishedInCurrentLanguage()
.FilterForVisitor()
.BoostMatching(x => x.PageTitle.MatchCaseInsensitive(searchTerm), 80)
.ApplyBestBets()
.Skip((page - 1) * itemsPerPage)
.Take(itemsPerPage)
.Select(x => new SearchResultViewModel { Title = x.PageTitle, Description = x.PageDescription, TargetUrl = x.ContentLink, ItemType = "Page" })
.IncludeType<SearchResultViewModel, NewsStoryPage>(x => new SearchResultViewModel { Title = x.PageTitle, Description = x.PageDescription, TargetUrl = x.ContentLink, ItemType = "News" })
.IncludeType<SearchResultViewModel, EventPage>(x => new SearchResultViewModel { Title = x.PageTitle, Description = x.PageDescription, TargetUrl = x.ContentLink, ItemType = "Event" })
.IncludeType<SearchResultViewModel, HeritagePropertyLandingPage>(x => new SearchResultViewModel { Title = x.PageTitle, Description = x.PageDescription, TargetUrl = x.ContentLink, ItemType = "Property", ImageResizerSetting = ImageResizerSetting, Image = (x.PageImage != ContentReference.EmptyReference && x.PageImage != null) ? _contentLoader.Get<ImageFile>(x.PageImage) : null })
.Track()
.GetResult();
Thanks for providing the code here.
I think the code looks good . Have you tried with rebuild index?
Is it necessary to rebuild index everyime after page expires? That's nonsense... I was hoping that Find has some functionality which removes pages from index if they expire...
I think no but I read somewhere that it is a bug in some earlier version of Episerver find.
Go to Episerver CMS admin panel and run the "EPiServer Find Content Indexing Job".
No, but if this resolves your issue then you can write some custom schedule jobs, etc.. to handle your scenario so please try once.
Are you using the Episerver Find 12 or lower?
i m using episerver find 13.2.2 .
I have to rebuild indexing after the expiration of the single page even after doing code
could you add a .Filter() to check if the expiry date has passed and filter out the expired content?
I added this line .Filter(x=>x.StopPublish.After(DateTime.Now)), but still getting expired pages.
@Ash Please contact Application Support and we can check that search request payload looks as expected with that code.
Also include Find index name and give an example on an object you're expecting not to be in the results.
Expired pages are still appearing in the search bar at the front end