Saturday, November 15, 2008

Crawled Properties - Which property do they crawl?

If you've explored Search in Sharepoint, you would know that you can create 'Managed Property' which map to Crawled property. Have you ever wondered how the crawled property maps to real fields?

I still dont have the answer for that, but below post shares my painful experience due to lack of the answer. Read on.



As you know,
whenever you run full crawl, Sharepoint crawls entire content, identifies all properties, including your custom fields ( say 'BirthDate' ) and creates a crawled property for the field. All the OOB fields are mapped to crawled properties prefixed with 'ows_', while for custom fields, crawl property with the same name is added.



Our Requirement:
A simple one. Along with page title, bring in the page description in search results displayed. So our plan of action was

a) Create a Managed Property (mp_description) mapping to ows_description ( Description is the field name in Page content type)

b) Search Results Web Part: Configure the Select Columns xml to fetch mp_description.




  • So went about performing the steps and the results - Description was not showing up :-(

  • Explored the default xslt in Search Results web part and found that it isnt generic enough to pick up new select columns added. You need to manually modify it whenever you want to bring additional fields in results display. We had to correct these. Yet no success :-(

  • We thought may be content indexing wasnt good and so wiped off current index and reran the full crawl. Again no success.

  • Now we're sure frustrated. We picked up the MOSS Query Tool (an amazing tool for any developer customizing Search in MOSS) to see what's happening. All results came up with description field empty. Another surprise :-(

  • How about Google? Nope no postings on this.

At this point, it was clear either Search crawl isnt indexing description properly or Search results web part isnt doing its job. We ruled out the later as when experimented with other crawled properties, results were proper.


Now zero'ing on to search crawl, it struck us that "how can be sure that the crawled property we were referring is the one really pointing to Page description".Is there mapping in some config file maintained in 12 hive? A brute search doesnt yield anything.


Now people who have created custom content types would know that you can inherit from existing content types and for fields inherited you can change the display names in your content type. Going on this thought, we went to Page content type, clicked on 'Description' field and from the link got the GUID of the field. Went back to 12 ->Features ->fields, Publishing fields feature a brute search showed that the internal name of description field was indeed 'Comments' !!!!!!!!!!!!!!!! (Page content type derives from Item, which has this field).

Atlast. Remapped our managed property to ows_comments now and guess what, we got page description shown up in the results!!!

Great deception by MOSS, costing us quite number of days to resolve.

No comments: