Try our conversational search powered by Generative AI!

Custom types has no name or type description in Explore-view


As seen below, when I get hits for custom types in the index, they show up as blank lines. I can open and browse then without problem, but the fact that they have no name makes this Explore-view near-useless.

I can see that pages, blocks and other CMS/Commerce-types have a property in the JSON called "_Name", which I suspect is being used for this. If I add this to my model, it shows up as "_Name$$string", and is not picked up by the GUI.

Is there any way to fix this or add some special property or whatever to this that can make the names show up in some way? This should be documented somewhere (it might be, but I have not found it...), as a *major* part of the entire search engine is utterly useless for editors.

Also, "Filter by type" to the right is unable to filter by the custom types - and I have no idea why. Shouldn't this just be a facet of the different types (the "$type" field), regardless of if it's CMS content/commerce content or not? The information is already in the index - to me it seems that stuff is purposly left out, which makes no sense whatsoever.

Aug 14, 2014 11:48

Image here, this forum won't let me insert it directly:

Edited, Aug 14, 2014 11:49

I suppose this is a bug. However, you could give this sort of hacky solution a shot:

SearchClient.Instance.Conventions.ForInstancesOf().IncludeField(x => x.GetOriginalType().Name);
SearchClient.Instance.Conventions.ForInstancesOf().Field(x => x.GetOriginalType().Name).Modify(x => x.PropertyName = "_TypeShortName");
SearchClient.Instance.Conventions.ForInstancesOf().IncludeField(x => x.Title.ToString());
SearchClient.Instance.Conventions.ForInstancesOf().Field(x => x.Title.ToString()).Modify(x => x.PropertyName = "Name" + TypeSuffix.String);

This should fix both the name issue and the type issue.
Replace "Title" property with whatever suits you. However, do not remove the calls to ToString, as that will override the original property in the index.

Aug 14, 2014 19:44

By the way, the image you posted is a tiny bit on the small side. Or maybe I need to put my glasses on :-)

Aug 14, 2014 19:51

Ah, great stuff! Thanks! Will test tomorrow. And the image link has been fixed, obviously needs "www" to work properly. :-(

Aug 14, 2014 20:48

A bit slow on the testing, but that did work out just perfectly! Should also be fixed somehow in the next patch, preferably with something like an attribute like [DisplayName] or whatever for the property you want to use as the name. :-)

Aug 20, 2014 9:37

It has been reported as a bug, so we'll have to wait and see :-)

Aug 27, 2014 15:00

This should have been fixed in the latest release as well

Sep 02, 2014 14:47

How can I modify the Name visible in Explore view? Would be great if we could use an attribute for this, like Arve suggests.

I have tried using Per Magne's code, but that is not working - it is still using Name property. I want to fetch it from another property.

PS: I'm using latest version of EPiServer.Find

Sep 10, 2014 8:58

The code Per Magne posted should fix the name in Explore view (Im currently at Find By switching "Title", you can stick in whatever you feel like.

Also, remember you have to reindex your content for it to have an effect.

Sep 10, 2014 9:16

If you already have a property called "Name", then that property will be used by default. The code I provided will simply create a new field called Name in the index and put the value of your choise in it. However, in Mari's case, where there already is a field called "Name", my code should not be applied, as it will mess up the queries (if you use the name property in queries that is).

Sep 10, 2014 9:30

Per Magne - does that mean if I have a property Name already, I'm not able to override what is being used in the Explore view?

Sep 10, 2014 10:03

The Explore view tries to use the following properties of an indexed object as a "Name" value in the speicifed order:

  • SearchTitle
  • PageName
  • Name
  • title
  • _id (this an internal ID of the indexed object)

After the latest update there shouldn't be empty lines any more.

Sep 10, 2014 10:31

Then I suppose you(Mari) could use SearchTitle or PageName then. Although I suppose the safest way would be to use PageName, as SearchTitle is used in unified search, assuming this is not a pagedata object.

Something like:

SearchClient.Instance.Conventions.ForInstancesOf().IncludeField(x => x.Name.ToString());
SearchClient.Instance.Conventions.ForInstancesOf().Field(x => x.Name.ToString()).Modify(x => x.PropertyName = "PageName" + TypeSuffix.String);

I did not test this though.

Edited, Sep 10, 2014 10:37

In my project we don not use unified search. I ended up adding a SearchTitle property to my object which solved it. No need for extra code (conventions).

Sep 10, 2014 11:27

whatever floats your boat :-)

Sep 10, 2014 11:39
* 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.