The UnifiedSearchHit.MetaData property doesn't get included in search results

Vote:
 

Pardon my newbishness regarding Find embarassed I'm trying to wrap my head around the unified search and doing the one step forward - two steps back dance.

I have a generic .NET class that gets indexed. I have some properites in the class I need to present in the search result and went with the MetaData property on the UnifiedSearchHit class. Problem is it doesn't seem to be returned with the search hits.

My class looks like the example below and the MetaData property is indexed propely. HitTypeName does get included in the search hits but MetaData doesn't.

public class MyVanillaDotNetClass
{
	// Other properties...

	public virtual string HitTypeName => FacetTypes.SteeringDocument.ToString();

	public virtual IDictionary MetaData
	{
		get
		{
			var dictionary = new Dictionary
			{
				{"owner", Owner},
				{"...", ...}
			};

			return dictionary;
		}
	}
}

I've tried messing with the Find initialization both adding ProjectMetaDataFrom as well as IncludeField, though I presume IncludeField only works for typed searches,

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf()
	.ProjectMetaDataFrom(d => d.MetaData);

Any suggesions for how I can include the extra properties in the search result would be greatly appreciated.

Thank you 

#192446
Edited, May 17, 2018 1:09
Galina Vedeneeva - Dec 17, 2020 10:55
Hello, HSBallina! Where you able to resolve this issue? I'm struggling with the similar one right now and still no luck.
Vote:
 

Hmm, I can not see it in the documentation here:

https://world.episerver.com/documentation/developer-guides/find/NET-Client-API/searching/Unified-search/customizing-default-projections/

When decompiling I see this:
[Obsolete("HitProjectionBuilder ProjectTitleFrom<T> is deprecated, please use IndexProjectionBuilder ProjectTitleFrom<T> instead.")]
public static HitProjectionBuilder ProjectTitleFrom<T>(this HitProjectionBuilder builder, Expression<Func<T, string>> sourceExpression)

Maybe it has something to do with this

#192455
May 17, 2018 8:57
Vote:
 

Thank you for your reply, Henrik. Projecting the title is actually working. The problem I'm facing is how to pass the metadata dictionary from the indexed instances. Other UnifiedSearchHit properties are passed as they should.

#192620
May 21, 2018 13:22
* 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.