When you use a Collaborative Application Markup Language (CAML) query to search content on a Microsoft Office SharePoint Server 2007 site or on a Windows SharePoint Services 3.0 site, the search results are incomplete. This problem occurs when the query uses the SPSiteDataQuery class.
This problem occurs for one of the following reasons:
The CAML query searches for content in more than 10 document libraries or document lists.
The CAML query searches for content across more than 10 explicit GUIDs.
The following condition must also be true:
The column mapping for a field in the Where clause is not the same in all the document libraries, in all the document lists, or in all the GUIDs in the query.
This problem occurs because a different query plan is used and because data is stored in a temporary table. Additionally, this problem occurs regardless of how you select the document library, the document list, or the explicit GUID. For example, this problem may occur if you select the list by using the ServerTemplate attribute, by using the BaseType attribute, or by using the ID attribute.
To resolve this issue use the Infrastructure Update hotfix for Windows SharePoint Services: For more information about the available hotfix, click the following article number to view the article in the Microsoft Knowledge Base:
951695 Description of the Infrastructure Update for Windows SharePoint Services 3.0: July 15, 2008
To work around this problem, use one of the following methods.
Method 1: Use the same column mapping for each field in the Where clause
To work around this problem, use the same column mapping for each field in the Where clause. When you use the same column mapping for each field in the Where clause, the query returns the correct results when you search for content in many document libraries, in many document lists, and in many explicit GUIDs.
Any field that will be in the Where clause has to map to the same database column on every list that will be included in an SPSiteDataQuery class. The order in which the fields appear in the Where clause does not matter To make sure that the field mapping is homogeneous, start from scratch and add the same set of columns in the same order. The field type does matter. Number fields will not interfere with Text fields. For example, consider List A, List B and six Number or Text fields, added in the following order:
List A: T1, N1, N2, N3, N4 List B: N1, N3, N2, N4, N5, T1
A query across lists that included only N1, N4, or T1 in the Where clause would be correct. However, a query that included N2 or N3 would not be correct. A query that included N5 would omit List A from the query, and would be correct by design. Windows SharePoint Services does not fill in missing fields in the Where clause. If N6 had been added to List A first, only the following query for T1 would be correct:
List A: N6, T1, N1, N2, N3, N4 List B: N1, N2, N3, N4, N5, T1
Method 2: Use multiple queries
To work around this problem, perform multiple queries. Use 10 or fewer document libraries, document lists, or explicit GUIDs in each query. Then, combine the results into a complete set.
For more information about the SPSiteDataQuery.Lists property, visit the following Microsoft Web site: