Override author name in search results

Dec 9, 2008 at 4:14 AM

Hi<o:p></o:p>

I want to show custom author on search results page rather than from document propeties. It picks up author from document properties and displays the same in search results page with size and last modified date. <o:p></o:p>

I tried the below way but not working 100%<o:p></o:p>

i tried - <o:p></o:p>

m_Properties.Add(new ChunkInfo(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 4, " custom author"));<o:p></o:p>

Above line shows custom author but when the author is blank in document property. When there is some author already exists it shows the same from document properties. I am not able to overide it.<o:p></o:p>

I tried n number of combinations but yet not working.
one of the try was -
m_Properties.Add(new ChunkInfo(new Guid("{BF85BE72-56C8-4d22-9386-B5D61B3B5ACC}"), "Modified_x0020_By", "custom author"));<o:p></o:p>

Can you tell me the what guid to use for above, i have created a new one. I am not sure if its proper way to do. Because for first try i have used Guid which is documented on msdn site  - http://msdn.microsoft.com/en-us/library/aa965725(VS.85).aspx. But for - Modified_x0020_By what guid to use?<o:p></o:p>

Please help.<o:p></o:p>

Thanks & Regards,<o:p></o:p>

Seema Karia<o:p></o:p>

<o:p> </o:p>

Dec 18, 2008 at 3:01 PM
Hi Seema,
 I hope the following is helpful...

The difficulty I had with metadata and the MOSSPH sample was trying to work out what Guids I should use to map my properties to the relevant and appropriate MOSS properties. Then it dawned on me that I didn't have to - a much better alternative was to use my own bespoke Guid and index all my properties to this. In terms of MOSSPH code example:-


    // My author
m_Properties.Add(new ChunkInfo(SearchProtocolGuids.MY_PSGUID, "MyAuthorField", "the value of my author property"));
// My title
m_Properties.Add(new ChunkInfo(SearchProtocolGuids.MY_PSGUID, "MyTitleField", "the value of my title property"));

After you've indexed with the above example, look in the Shared Services Admin -> Metadata properties -> Crawled properties, you'll see "Category 1" (or perhaps 2 etc.) and it will contain the crawled properties "MyAuthorField" and "MyTitleField" along with any others you choose to use.

The missing bit is to map MOSS Managed Properties (such as Author and Title) to use your custom crawled properties aswell as (or instead of) the standard Office document property values...

In Shared Services Admin -> Metadata properties find the Author managed property and edit it:-
Look at the "Mappings to crawled properties" section.
  1. I think the default for Author is to "<label for="ctl00_PlaceHolderMain_includeAllRadioButton">Include values from all crawled properties mapped</label>" - change this to "<label for="ctl00_PlaceHolderMain_includeSingleRadioButton">Include values from a single crawled property based on the order specified</label>".
  2. Click "Add Mapping" and select your "MyAuthorField"
  3. Once added to the mapping list, you probably want to move "MyAuthorField" to the top of the list - this way, if your content supplies an author, then that will be used, otherwise the filter daemon will look for the next crawled property in the list.
  4. I'm fairly certain you'll need to run a full index after changing the Managed Properties -> Crawled properties.
  5. Try your search now - hey presto, your "MyAuthorField" values should appear instead of the Office document properties author.
Kind regards,
  Ed
Dec 19, 2008 at 10:05 AM

 

Hi EdSawdon,

 

Thanks a lot for your help. Its working.

 

In my earlier discussion i have mentioned that i was trying the below line -

m_Properties.Add(new ChunkInfo(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 4, " custom author"));

which was not working for me.

{F29F85E0-4FF9-1068-AB91-08002B27B3D9} is the guid for crawled property Office:4 which is mapped to Author manager property, so i was trying to override that property by giving custom author.

This method was working for me when i was trying to override the Title property, but the same not working for author, so was struggling a lot.

But then when i tried the same line - m_Properties.Add(new ChunkInfo(new Guid("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"), 4, " custom author")); on some other sharepoint server it was able to overide the author property and worked.

Trying to figure out what was is the difference between my server and other server but could not get it.

Anyways this is working for me and thanks a lot.

 

Regards,

Seema