November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I would add a new readonly property called CountryName to your EventPage that's a string representing the country name (lazy load the country name as it will only be accessed when the EventPage is indexed by Find). Makes it real simple to search and facet on the country when searching events.
Then I'd add a ContentUpdating event handler for your County page, use Find to look for all events in that country and update the related event pages.
Given I guess the countries are not renamed too often performance shouldn't be a big issue?
David
I asked a simular question a while ago and use the answer I got a lot and it works great. Read more here:
http://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2015/5/best-pratice-for-including-information-that-does-not-exist-on-content/
In summary it says that you should create a extension method for the pagetype and a function in it to pick up county name, then in a initialization module add something like this:
SearchClient.Instance.Conventions .ForInstancesOf<EventPage>() .IncludeField(x => x.CountyName());
This makes that Find will add a new property named CountyName to the object and it will only access it when indexing.
Later you can do terms filtering och things like that on it
Thank you guys! Extension method works like a charm :)
I need help with update method.
Init module:
private void ContentEvents_PublishedContent(object sender, EPiServer.ContentEventArgs e) { var countyPage = e.Content as CountyPage; if (countyPage != null) { var eventPages = SearchClient.Instance.Search<EventPage>() .Filter(x => x.County.Match(countyPage.PageLink)) .Take(1000) // return any field .Select(x => x.PageLink) .GetResult(); foreach (var searchHit in eventPages.Hits) { SearchClient.Instance.Update<EventPage>(searchHit.Id) .Field(x => x.CountyName(), countyPage.Name) .Execute(); } } }
1. Can I update EventPage(s) in one go, or do I have to update them one by one?
2. The above code throws the following exception:
An exception of type 'EPiServer.Find.ServiceException' occurred in EPiServer.Find.dll but was not handled in user code Additional information: The remote server returned an error: (403) Forbidden. Your key is not authorized to access (POST) '/INDEX_NAME/Models_Pages_EventPage/_700f7047-ce29-456d-9403-af5d6205584e_no/_update'
Thanks
If you are using Update, I think you need to do them one by one.
It would be better to just index a batch of EventPages
SearchClient.Instance.Index(eventPages);
Hi,
I'm working with EPiFind 10 and EPiServer CMS 9. I need to display a list of events filtered by county.
My EventPage looks like this:
And search logic w/o filtering:
During indexing, I would like to index a county name (page name of County page type that is referenced by EventPage), and filter events by that field.
When the editor renames the county page, I would like update the search index and all documents of type EventPage (or my custom document) that have
I basically need something like http://tedgustaf.com/blog/2013/4/add-custom-fields-to-the-episerver-search-index-with-episerver-7/ , but for EPiFind 10.
Should I let EPiFind index EventPage(s) as usual, and explicitly index documents that are optimized for search: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Find/10/DotNET-Client-API/Indexing/
How can I execute bulk update? Can I use NewCommand for that?
Any help would be greatly appreciated!