Kentico Smart Search突然返回空结果:登录后台正常,退出则无结果求助
Hey Michelle, sorry to hear you're hitting this frustrating Kentico Smart Search issue—let's walk through some targeted troubleshooting steps to get to the bottom of why anonymous users aren't seeing results while logged-in users do.
Check the Search Index's Crawling Context
Kentico’s search index might have been configured to crawl content while logged in, meaning it indexed content that requires authentication. Head to your index settings (Settings → Search → Search indexes) and verify the Crawl as user setting. If it’s set to a specific authenticated user, switch it to the built-inpublicuser (or another account with anonymous-level permissions) and rebuild the index. This ensures the index only includes content anonymous users can access.Deep-Dive into Document/Page Security Settings
Even if you checked web part visibility, individual pages or documents might have hidden security restrictions blocking anonymous access. For every content type that appears in logged-in results:- Open the document in the content tree
- Navigate to the Security tab
- Confirm the
EveryoneorAnonymous Usersrole has at least Read permission - Also check Workflow security—content stuck in a draft/editor-only state won’t be visible to anonymous users, even if it shows up in logged-in searches
Audit the Smart Search Results Web Part Configuration
Double-check the web part settings on your results page. Look at the Search in section to ensure it’s targeting the correct index, and confirm there are no accidental filters excluding anonymous-accessible content. For example, some filters might be set to only include content the current user has permission to view—if the index was built with an authenticated context, this could create a mismatch for anonymous users.Check for Custom Code/Macro Issues
If you’ve added custom macros or code to modify the search query (e.g., in the web part’s Search query property or a custom event handler), verify it’s not adding filters that only work for authenticated users. A broken macro like{% CurrentUser.IsAuthenticated ? "" : "+visibility:private" %}could accidentally filter out all content for anonymous visitors.Compare Live vs. Staging Index Configurations
Since staging works fine, do a side-by-side comparison of search index settings between environments. Pay close attention to:- Crawl settings (crawl as user, included/excluded paths)
- Index-level security permissions
- Custom modules or event handlers that affect search on live but not staging
Enable Search Debugging
Turn on Kentico’s search debugging to see exactly what’s happening when anonymous users search. Go to Settings → System → Debug and enable Search debugging. Then, as an anonymous user, run a search and check the debug output (usually at the bottom of the page) to see:- The exact search query being executed
- Which index is being used
- How many results the search engine returns before Kentico applies permissions/filters
This can help you spot if the issue is with the query, the index itself, or post-query filtering.
Clear All Caching Layers
Anonymous user caching can sometimes serve stale or incorrect search results. Clear Kentico’s internal cache (System → Cache → Clear cache) and check if your web server has output caching enabled for the search results page that might be interfering with fresh results.
内容的提问来源于stack exchange,提问作者Michelle

