I am working on team sub-site inside my sharepoint on-premises farm 2013. now i define the following criteria to show all the items inside a document library:-


 Path:"http://w*****/*****/******/Shared Documents/"

enter image description here

now i have noted that if i have images with the following extensions .png or .gif or .jpg. then they will have the following Names DispForm.aspx inside the search results, while the title will be correct, as follow:-

enter image description here

Although if i chose to display the item properties i will get the correct names and title something as follow:-

enter image description here

now inside the display template i am using the following managed properties:-

  • For the Name = FileName
  • For the Title = Title

as follow:-

<mso:ManagedPropertyMapping msdt:dt="string">'ListID','ListItemID','ContentTypeId','Link URL':'Path','CommentOWSMTXT','BodyOWSMTXT','Property 1':'FileName','Property 2':'Title'./*other properties goes here...*/..</mso:ManagedPropertyMapping>

so what could be the reason that the Names for the images specifically is being shown as DispForm.aspx ??

2 Answers 2


You need to make sure that the item is being handled as a specific file type rather than as a list item in a library.

There are specific instructions here, but basically:

  1. Go to Central Admin > Search Service Application
  2. File Types > New File Type.
  3. Enter an image type/types you want to handle with this rule (repeat as necessary)
  4. Go back to the searched library/list's list settings
  5. Go to Advanced settings and reindex it.
  6. Kick off the search crawl.

If you want more specific behavior than just an image in the search results, you'll need to create a new/edit an existing display template.

  • ok will try you steps.. but is there a specific reason why sharepoint does not add these types "gif", "jpg", "png" inside the search service by defualt ?
    – John John
    Aug 22, 2017 at 17:11
  • 1
    It's one of those things where not all groups want to make their farms image friendly. You may have a search where you only want full content coming back based on the term rather an image that has that term in the name or some part of it's data. I've also had some farms where we had professional documents in the same site as employee cookout photos that I wouldn't want seen in a search for a related term. Also, Microsoft. ¯_(ツ)_/¯
    – Graham
    Aug 22, 2017 at 17:18
  • now should i re-index the related libraries one by one? as in my case i did an index reset from the central administration, then i run a full crawl.. but still i am seeing the images have Dispform.aspx as their names inside the search result web part..
    – John John
    Aug 22, 2017 at 17:24
  • now i reindex the document library and i also i did an index reset for the whole search service ,then i run a full crawl, but still the images will have Dispform.aspx as their names !!!
    – John John
    Aug 22, 2017 at 17:32
  • 1
    It should be a reindex on the library itself first. I'm sure there's powershell script if you wanted to force it and there are background processes that handle indexing if you feel like waiting long enough for that to kick it. If that's still not taking you may have to edit the display template.
    – Graham
    Aug 22, 2017 at 17:47

I POC'd this for you in SharePoint Online tonight, but using a 2013 Search Center. Results could vary based on on-premises vs Online, but I'm hopeful this information will provide the answer you're looking for.

Unfortunately the OOB managed property you'd expect to work (Path) is always going to point to the DispForm.aspx, since it's not indexing the image file itself.

You'll also see that another OOB managed property (FileType) will show you things like 'JPG', but you still won't have your file reference. What you need is 'Filename', which is the reference to the file within its parent (it won't include the full path, just the file name and extension)

I'd be happy to look at your display template in more detail, but I'm wondering if there's a formatting issue in there (since I see you're trying to use Filename, which is correct, but you're still getting DispForm.aspx).

I added 'Filename':'Filename' to the end of my display template's ManagedPropertyMapping tag (item_default.html), and when I went in to debug the results (targeting item_default.js in Chrome), you'll see in the below screenshot that it indeed does return the correct filename for that property.

Updated ManagedPropertyMapping Display Template with Filename

Debug results with the correct filename showing enter image description here

I hope that this information helps solve your problem, and again, feel free to reach out to me directly if you're still having issues, and would like a second set of eyes on your display template and/or debugging session.

Cheers, Matt

  • 1
    Yeah - it should be Filename, not FileName. That format 'Value': 'Value' essentially means you'll have properties off CurrentItem mapped to the names of managed properties after the colon (multiple values can be separated with semi-colon), and then you can use what comes before the colon inside of $getItemValue(ctx,'Value'). Can you change 'Property 1':'FileName' to 'Filename':'Filename', and then debug and confirm that your ctx.CurrentItem.Filename is correct? You should get the same thing when you debug with $getItemValue(ctx,'Filename'). Aug 24, 2017 at 18:11
  • 1
    Also, regarding your question about other file types working, that's because SP is indexing their actual content (pdf, docx, etc..). It's not indexing into the images, but Filename is an easy way to get a link directly to the image. Cheers. Aug 24, 2017 at 18:12
  • 1
    Have any updates after trying the above listed in the comments, John? Aug 25, 2017 at 15:31
  • 1
    Can you share your entire managedpropertymapping? I want you to change the part referencing Filename. Aug 28, 2017 at 2:28
  • 1
    Would love to help you resolve this before the bounty ends tomorrow. I was just asking you to change your managed properties, and then have you debug, to confirm the ctx.CurrentItem had the correct Filename. Aug 28, 2017 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.