Search Results XML Data returns first line of text as the result title instead of the title field for some .doc files
Excuse the very long title, I was just trying to be descriptive :)
I have a number of word documents stored in a document library in a document centre. For most of the documents when I search for a term, the content that's in the "Title" field is returned in the result's title node in the Search Result XML. However there are a number of documents that return the first line of text in the document's content as the title. This is very peculiar bahaviour and I can't seem to find a way to fix it. I've investigated the metadata property mappings and looked at the 'Title' property and it's retrieving the following mappings in this order:
- Mail:5(Text)
- People:PreferredName(Text)
- Basic:displaytitle(Text)
- ows_Title(Text)
As you might have guessed, these are the same as the default settings and have not been changed. I have attempted to adjust the mappings and reorder them but nothing fixes the problem. I don't see how any of these mappings would return the first line of text from a document when none of them detail it.
How the blazes do I get the search results to show the Title field of the documents?
This is the SPItem's XML:
ows_ContentTypeId="0x01010088DB89BAACA04F38A0BEE018DD0A5206009C6E9BFBC6CE4C099BF7D9D3BF986B550037DF08371674094BBD60CFE875673FD0"
ows_FileLeafRef="68;#LOE_CO_GRO600_310110.doc"
ows_Modified_x0020_By="SHAREPOINT\system"
ows_Created_x0020_By="SHAREPOINT\system"
ows_File_x0020_Type="doc"
ows_Title="Growth Programme"
ows_NotesAndInstructions="Use this letter where we facilitate growth programme sessions"
ows_DocID="CO_GRO610"
ows_DocumentPublicationDate="2006-11-01 00:00:00"
ows_TaxCatchAll=""
ows_TaxCatchAllLabel=""
ows__dlc_DocId="DOC-2047-3109"
ows__dlc_DocIdUrl="http://server/_layouts/DocIdRedir.aspx?ID=DOC-2047-3109, DOC-2047-3109"
ows_SectorGroup=""
ows_ServiceLine=""
ows_ID="68"
ows_ContentType="Engagement"
ows_Created="2010-08-24 11:37:19"
ows_Author="1073741823;#System Account"
ows_Modified="2010-08-25 14:03:47"
ows_Editor="1073741823;#System Account"
ows__ModerationStatus="0"
ows_FileRef="68;#DocumentCentre/EngagementLetters/LOE_CO_GRO600_310110.doc"
ows_FileDirRef="68;#DocumentCentre/EngagementLetters"
ows_Last_x0020_Modified="68;#2010-08-25 13:56:14"
ows_Created_x0020_Date="68;#2010-08-24 11:37:20"
ows_File_x0020_Size="68;#59392"
ows_FSObjType="68;#0"
ows_SortBehavior="68;#0"
ows_PermMask="0x7fffffffffffffff"
ows_CheckedOutUserId="68;#"
ows_IsCheckedoutToLocal="68;#0"
ows_UniqueId="68;#{ACE05805-6E2A-4035-A6D2-73CDF2962374}"
ows_ProgId="68;#"
ows_ScopeId="68;#{519A3EC0-039D-4F4C-A829-C9D17A9626E1}"
ows_VirusStatus="68;#59392"
ows_CheckedOutTitle="68;#"
ows__CheckinComment="68;#"
ows__EditMenuTableStart="LOE_CO_GRO600_310110.doc"
ows__EditMenuTableStart2="68"
ows__EditMenuTableEnd="68"
ows_LinkFilenameNoMenu="LOE_CO_GRO600_310110.doc"
ows_LinkFilename="LOE_CO_GRO600_310110.doc"
ows_LinkFilename2="LOE_CO_GRO600_310110.doc"
ows_DocIcon="doc"
ows_ServerUrl="/DocumentCentre/EngagementLetters/LOE_CO_GRO600_310110.doc"
ows_EncodedAbsUrl="http://server/DocumentCentre/EngagementLetters/LOE_CO_GRO600_310110.doc"
ows_BaseName="LOE_CO_GRO600_310110"
ows_FileSizeDisplay="59392"
ows_MetaInfo="[...]vti_cachedtitle:SR|Growth Programme
vti_title:SR|Growth Programme[...]"
ows__Level="1"
ows__IsCurrentVersion="1"
ows_ItemChildCount="68;#0"
ows_FolderChildCount="68;#0"
ows_SelectTitle="68"
ows_SelectFilename="68"
ows_Edit="0"
ows_owshiddenversion="4"
ows__UIVersion="512"
ows__UIVersionString="1.0"
开发者_JAVA技巧ows_Order="6800.00000000000"
ows_GUID="{77095282-3E97-4703-9249-A6E888F5ED70}"
ows_WorkflowVersion="1"
ows_ParentVersionString="68;#"
ows_ParentLeafName="68;#"
Etag="{ACE05805-6E2A-4035-A6D2-73CDF2962374},4"
ows_Combine="0"
ows_RepairDocument="0"
ows_ServerRedirected="0"
This seems to be an issue when SharePoint 2010 indexes 2003 word documents (.doc).
I worked around this by using the Filename as the display property for all documents.
You have to edit the Search Results web part (I have shown my changes by ** the changes **):
Add Filename to the fetched items:
<Columns> **<Column Name="Filename"/>** <Column Name="WorkId"/> <Column Name="Rank"/> <Column Name="Title"/> <Column Name="Author"/> <Column Name="Size"/> <Column Name="Path"/> <Column Name="Description"/> <Column Name="Write"/> <Column Name="SiteName"/> <Column Name="CollapsingStatus"/> <Column Name="HitHighlightedSummary"/> <Column Name="HitHighlightedProperties"/> <Column Name="ContentClass"/> <Column Name="IsDocument"/> <Column Name="PictureThumbnailURL"/> <Column Name="PopularSocialTags"/> <Column Name="PictureWidth"/> <Column Name="PictureHeight"/> <Column Name="DatePictureTaken"/> <Column Name="ServerRedirectedURL"/> </Columns>
Then you will have to edit the XSLT to display the file name if the item is a document (make sure to uncheck Use Location Visualization. if you don't your changes will not take). You will have to search the xslt to find the section below. Again the items in-between the ** ** is what I added.
**<xsl:if test="isdocument = 'True'">
<xsl:value-of select="filename"/>
</xsl:if>
<xsl:if test="isdocument = 'False'">**
<xsl:choose>
<xsl:when test="hithighlightedproperties/HHTitle[. != '']">
<xsl:call-template name="HitHighlighting">
<xsl:with-param name="hh" select="hithighlightedproperties/HHTitle" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="title"/></xsl:otherwise>
</xsl:choose>
**</xsl:if>**
精彩评论