Troubleshooting SharePoint Document Library Search Issues
Problem Statement
When using the KQL query ContentClass:STS_List_DocumentLibrary without additional filters, some document libraries (like “Shared Documents”) are not appearing in search results, even though they exist and contain content.

Initial Troubleshooting Steps Taken
1. Hidden Site-Level Visibility Setting
Action: Visited https://<your-site>/_layouts/srchvis.aspx and enabled “Always index all Web Parts on this site”
Status: ✅ Enabled - Monitoring for 24-48 hours to see if this resolves the issue
Result: No effect on bringing the shared documents search result
2. Draft or Unapproved Items Check
Question: Are items in the library marked as drafts or pending approval?
Finding: ❌ Content approval is not turned on
Conclusion: This is not the cause of the issue.
3. Search Schema Configuration
Question: Are custom columns properly mapped to managed properties?
Finding: ❌ No custom columns are used in this library
Conclusion: Schema mapping is not relevant to this issue.
4. Search Scope or Result Source
Question: Is the query scoped too narrowly?
Testing: Executed query at tenant level with no success
Conclusion: Scope is not the limiting factor.
5. Direct Path Query Test
Query Used: ContentClass:STS_List_DocumentLibrary AND Path:"<library URL>", e.g. Path:‘https://contoso.sharepoint.com/sites/ProductSupport/Shared Documents’
Result: ❌ No results returned
Conclusion: Path to a custom library works but not to the OOB Documents library
Advanced Troubleshooting with PnP PowerShell
Install-Module PnP.PowerShell prior to run the script
Connect-PnPOnline -Url "https://<your-tenant>.sharepoint.com" -Interactive
Get-PnPSearchCrawlLog -Path "https://<your-site>/<library>" -StartDate "2025-10-01"
Additional Diagnostic Queries
Try these KQL queries to narrow down the issue:
// Test 1: Check if site is indexed
Path:"https://yourtenant.sharepoint.com/sites/yoursite"
// Test 2: Search for specific known document
filename:"knowndocument.docx"
// Test 3: Check all lists and libraries on site
(ContentClass:STS_List OR ContentClass:STS_List_DocumentLibrary) Path:"https://yourtenant.sharepoint.com/sites/yoursite"
// Test 4: Search by list ID (if known)
ListId:"{your-list-guid}"
Try the search api
Thanks to Beau Cameron, I tried native Search API and the data is being returned. For some reasons the library is not returned to the OOB Search experience.
https://constoso.sharepoint.com/_api/search/query?querytext='ContentClass:STS_List_DocumentLibrary AND Path:"https://contoso.sharepoint.com/sites/ProductSupport/Shared Documents"'

Conclusion
The library Shared Documents are not searchable using KQL query ContentClass:STS_List_DocumentLibrary fromt the OOB search experience. Anyone got any ideas to resolve the issue let me know.
References
- SharePoint 2013 Keyword Query (KQL) Content Class Property Restrictions
- Microsoft Documentation: Manage the search schema in SharePoint
- Understanding KQL Queries in SharePoint
