November Happy Hour will be moved to Thursday December 5th.

Set object name in EPiServer for Explore tab

Vote:
 

Hi,

How can I change object name in 'Explorer' tab?

Id for object was changed:

client.Conventions
                .ForInstancesOf()
                .IdIs(p => p.Id);

Object:

public class BusinessListItem    {       

        public int Id { get; set; }
        public string Heading { get; set; }

}



#141066
Nov 09, 2015 12:09
Vote:
 

The easiest way to do this is probably to add a property named "SearchType" or "Name" which returns the heading property.

Check out this thread for more information:

http://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2014/8/Custom-types-has-no-name-or-type-description-in-Explore-view/

#141086
Nov 09, 2015 14:43
Vote:
 

'Name' propeprty can be used for those purposes.

Thanks

#141088
Nov 09, 2015 15:06
Vote:
 

Hi Per Magne Skuseth ,

I can't include additional property ('Name') to object in some situation (e.g. external type wasn't available to modification).

Is it possibile somehow use IncludeField functionality to add new property with name 'Name' and value from other property ('Heading')?

public class BusinessListItem    {
        public int Id { get; set; }
        public string Heading { get; set; }
}
#141296
Nov 11, 2015 13:58
Vote:
 

Hi,

Yes. Create a new extensions method for you object type (BusinessListItem) called "Name", and then create an initializable module where you specifiy that the field should be included.

Example:

        public static string Name(this Product p)
        {
            return p.Heading;
        }
            // put in an initializable module
            SearchClient.Instance.Conventions.ForInstancesOf<Product>().IncludeField(x => x.Name());
#141324
Nov 12, 2015 7:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.