I need to be able to remove the description text within search results which displays a portion of an indexed document, however I only want this to affect a single library’s documents (or sub-site). Is it possible to localize something like this in such a way? Through XSLT, or the sp object model, or custom trimming or anything.. maybe somehow intercept the index query results, strip out the relevant text, then pass it along.
One idea that almost worked was to wrap the srch-description div in the core web part’s XSLT in an if statement that checks if the item’s url contains my library’s name, however this xslt change would have to go into any site that searches on my library and that’s not possible. I wonder if there’s anything more I can do to remove srch-description or decouple it from my items..
Disclaimer: this is a suggestion – I have not tried this!
I suggest populating (and if necessary creating) a Description field in your document library. This field might contain some innocuous description text. Next, create a new SharePoint search content source pointing to the document library. Map the metadata crawled properties (Description -> ows_Description) and check the “Include values for this property in the search index” checkbox. You may also need to add a crawl rule to the original source to exclude your “special” document library.