I am trying to change the aspx file icon from default icon to customized icon. I edited the xsl of the results.aspx page "fetched properties" for this section. I wanted to make sure that LegalDoc16.gif icons are displayed for the items who has "LegalDocument" content type. Please let me know if I dont have to syntaxed properly configured. I can do a search like ContentType:"legaldocument" and I get all the documents. so I know contenttype metadata property is being pulled. Please suggest.
<div class="srch-Icon" id="{concat($currentId,'_Icon')}">
<xsl:choose>
<xsl:when test="string(ContentType)='LegalDocument'">
<img align="absmiddle" src="_layouts/images/LegalDoc16.gif" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:when>
<xsl:otherwise>
<img align="absmiddle" src="{imageurl}" border="0" alt="{imageurl/@imageurldescription}" />
</xsl:otherwise>
</xsl:choose>
</div>
I believe there is a bug that prevents the ContentType metadata property being used (see http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/cd059e1c-7af6-454c-8568-a22e7755ce8c)
You need to create a new managed metadata property and map it to the ows_ContentType crawled property (I called mine CType), after this do a full crawl (you may need to delete the index first) to have the property available in the search index.
Then edit the Search Core Results web part and add
to Fetched Properties (under Display Properties) after
<columns>
Then update your xml to the following
P.S. This question is possibly a duplicate of I think my xslt may not be formatted correctly
Everthing was fine. All I had to do before running the powershell, go to the document library and add a file based on Linked to Document (and delete the test upload file). After that it worked.