I have Node Promo which has a property of type MultiNodeTreePicker and selects which days of week this Promo is valid. I need to perform a search for promos. I have OnExamineGatheringNodeData handler:
private void OnExamineGatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
var content = applicationContext.Services.ContentService.GetPublishedVersion(e.NodeId);
if (content != null)
{
switch (content.ContentType.Alias)
{
case "promo":
IEntityService entityService = ApplicationContext.Current.Services.EntityService;
//dayOfWeek
string days = String.Empty;
string featuresAsString = content.Properties["dayOfWeek"].Value != null ? content.Properties["dayOfWeek"].Value.ToString() : "";
if (!string.IsNullOrEmpty(featuresAsString))
{
string[] f = featuresAsString.Split(',');
foreach (string item in f)
{
Udi udiFeature;
if (Udi.TryParse(item, out udiFeature))
{
var guid = GuidUdi.Parse(udiFeature.ToString());
var response = entityService.GetByKey(guid.Guid);
days = String.Format("{0} {1}", days, response.Id);
}
}
}
e.Fields.Add("days", days );
break;
}
}
This code adds the Ids of "day of week" nodes to my search index and I am able to filter by day of week.
The question is how to save the property Title of "day of week" doc. type as well in the search index in order to display it at the result page without making additional request to Umbraco? The web site will have a lot of promos and the search/result should be very fast.
MNTP search
I have Node Promo which has a property of type MultiNodeTreePicker and selects which days of week this Promo is valid. I need to perform a search for promos. I have OnExamineGatheringNodeData handler:
This code adds the Ids of "day of week" nodes to my search index and I am able to filter by day of week. The question is how to save the property Title of "day of week" doc. type as well in the search index in order to display it at the result page without making additional request to Umbraco? The web site will have a lot of promos and the search/result should be very fast.
Hi Mila
If I understood you right, you can do what you with this code:
Then you will be able to get data from index field "title" on the search result page
/Alex
Hi, Alex, The content variable is of type Promo. I need property Title of "day of week" document type.
is working on a reply...