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.
Image here, this forum won't let me insert it directly: http://bildr.no/view/b3diU0F1
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.
By the way, the image you posted is a tiny bit on the small side. Or maybe I need to put my glasses on :-)
Ah, great stuff! Thanks! Will test tomorrow. And the image link has been fixed, bildr.no obviously needs "www" to work properly. :-(
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. :-)
Great!It has been reported as a bug, so we'll have to wait and see :-)
This should have been fixed in the latest release as well
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
The code Per Magne posted should fix the name in Explore view (Im currently at Find 126.96.36.1994). 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.
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).
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?
The Explore view tries to use the following properties of an indexed object as a "Name" value in the speicifed order:
After the latest update there shouldn't be empty lines any more.
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.
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.
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).
whatever floats your boat :-)