SharePoint Search Query Tool

Using SharePoint Search Query Tool

This post was most recently updated on January 13th, 2023.

2 min read.

If you’re working on SharePoint deployments, and aren’t familiar with the SharePoint Search Query Tool, you’re probably doing something wrong. Or you’ve got a really troublefree tenant and simple requirements.. :) At least for technical issues, it’s the #1 tool for debugging what’s in the index and what isn’t. This blog post describes how to use it to investigate SharePoint Online Search index issues.

First of all, you can get the tool from here: https://github.com/SharePoint/PnP-Tools/tree/master/Solutions/SharePoint.Search.QueryTool.

Logging in to strange or difficult SharePoint Online sites

If you’re like me, you have a lot of different customers/partners/friends or family, who all have different tenants and use different authentication methods. The tool does support logging in with pretty much any user account you might have on your hands, but sometimes messes up with federation or caching the credentials.

However, for the SharePoint Online site login, the application seems to use an internal browser login dialogue, which remembers and caches your earlier credentials, which might sometimes be tricky, because it might make it difficult to use the credentials you should be using.

Time needed: 20 minutes.

How to use the SharePoint Search Query Tool to investigate search index issues in SharePoint Online

  1. Clicking this link opens up a login dialog, and depending on the type of the site and your last login, you may or may not see the option to change the account.

    SharePoint Search Query Tool login options

    SharePoint Search Query Tool login options

    In the screenshot below I could actually use a cloud login… But the description text was blocking the option to change accounts! Pretty annoying, eh? 


    SharePoint Search Query Tool login popup

    Well, that’s just plain annoying!

  2. Even when there’s no option to use another account or authentication is redirected directly to the login screen (probably happens with some ADFS scenarios), it’s possible to change the site against which you’re authenticating with the following trick. The logic screen is technically an internal browser, right? It actually works as one, too. Press CTRL+L, and it’ll open you Internet Explorer’s “open”-popup – which accepts URLs!


    SharePoint Search Query Tool login popup with Internet Explorer Open-dialog
    SharePoint Search Query Tool login popup with Internet Explorer Open-dialog

    On that textbox, you can just write “https://login.microsoftonline.com/” and it’ll redirect you to cloud login (so you won’t be forced to the ADFS login).

    Pretty cool, huh?

  3. Fetching all Managed Properties

    To be able to view all managed properties from the items in the search index, add this text to your Refiners -textbox:

    managedproperties(filter=600/0/*)

  4. As always, remember to disable “Trim Duplicates” by unchecking the checkbox under the “Query Text” text area.

    When has that functionality actually served its purpose, anyway?

    SharePoint Search Query Tool - Trim Duplicates disabled
    SharePoint Search Query Tool – Trim Duplicates disabled

Okay, so that’s the gotchas and tricks I’ve encountered so far! If you have any I’m missing, drop them in the comments-section below! 😄

Awesome resources

mm
4.4 5 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
most voted
newest oldest
Inline Feedbacks
View all comments