SharePoint 2010: Limit search to return a Document Set after matching on its child item
In SharePoint Server 2010, say I set up a Document Se开发者_开发知识库t and put some Word documents in it. Each Word document contains a common phrase that is found only in the body of the Word Documents.
When searching for this common phrase that exists in each of the Word Documents, is there a way to return only the Document Set in the search results, instead of returning each individual Word document?
Use this syntax:
http://yoursite/_layouts/OssSearchResults.aspx?k=[searchterms]site:" http://yoursite/yourlibrary/yourfolderordocset"
Found this here
Customize the XSLT
If the phrase is always the same, you can create a search page just for this search. From the post it is not clear whether you would need a scope, you could use a limited search, i.e. 'this list' type of thing. You can customize the core results web part to add the column with the doc set name/title. Update the XSLT to only show the doc set name/title of items in the search results. This assumes that the results are only doc sets, if the search will return doc sets mixed in with other items, you can still include conditional logic in the XSLT to only display the doc set title/name when the search item is a doc set.
Samples
Merging documents with identical schema -- or in your case, combining like elements in the same schema. (from solution 6.4 in the book)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:param name="doc2"/>
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="* | document($doc2)/*/*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Perform set operations, like a union on node sets using XPath. (from solution 7.1 in the book)
<xsl:copy-of select="$node-set1 | $node-set2"/>
Book Recommendation
XSLT Cookbook by Sal Mangano, published by O'Reilly
精彩评论