More on icons

Developer
Jun 27, 2008 at 5:39 PM
I've sucessfully created a search page,  and am getting good returns,  but am not getting icons on the search results (getting the red x).

I downloaded the latest ImageToMimeMapping.xml and copied it to the bin directory for my site (in my case c:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin), but I am not seeing icons for any of the document types (including text and html).

When viewing the source for the page, the html for the icon looks like:
    <img align="absmiddle" src="" border="0" alt="Result of type:Text">

I've confirmed that ...\web server extensions\12\TEMPLATE\IMAGES contains the ICTXT.gif file.

Any ideas what could be causing this?
Developer
Jun 30, 2008 at 5:47 AM
That can happen if the "contenttype" index profile field does not contain a mime type (not mapped while indexing the document) or the field is not existing at all in the index profile.
The idea was actually to in this case return a default image but that has not been done. Instead no image is returned in the current version.
I will change that in the source code so the next time a build is done a default image will be returned.
An easy workaround to not have to reindex and fill that field in the indexprofile could be to change the xslt so that a default image is returned if no mime type is available.
Developer
Jul 10, 2008 at 8:59 PM
I finally was able to determine what was going wrong with icons and their associated descriptions on my installation.

We had previously installed the web parts that were demonstrated at FastForward 08,  and those parts used a attribute named imageurl (for the url of the preview image if present),  so the imageurl attribute was already present in our index.

The code in ESPSearchResults.cs inserts elements in the result xml for all attributes in the index,  and then adds an "imageurl" element that contains the image of the icon (and the description which is displayed as the alt text for the result hyperlink). 

When the xsl was rendered using the SearchResults.xslt,  the first imageurl element in the xml tree was used for the url/description of the icon, which was the imageurl present in our index.  In our case,  this attribute was empty,  so the generated html did not contain a valid reference to an icon image.

For now,  I plan to change the name of the generated element and the associated xslt reference to something other than imageurl,  but we will proably remove this attribute from our index the next time we reindex.

I don't know if anyone else will run into this,  but thought it might be helpful to someone.
Developer
Jul 15, 2008 at 1:06 PM
In that case you should be able to change the xslt for the result list and select the last occurrence of the imageurl attribute.

Change the select="imageurl" entries to : imageurl[position()=last()]
This will select the last imageurl field in the result Node.
That should solve the issue.