SaaS CMS has officially launched! Learn more now.

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


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
			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,

	.ProjectMetaDataFrom(d => d.MetaData);

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

Thank you 

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.

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

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

May 17, 2018 8:57

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.

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.