I have a site with two webparts (search input field and search results). On each pageload it's searching for an empty string and returns all results, similar to "*".

Querytext: {SearchBoxQuery}( IsDocument:"True" OR contentclass:"STS_ListItem_GenericList")

Is there a way to show the results not until the user presses enter or the search button?

Thanks in advance!

  • Why don't you specify If Condition if not null? Apr 8, 2014 at 11:54
  • Where can i do this, what's the Syntax for my querytext?
    – mbauer
    Apr 8, 2014 at 13:24
  • Using the "?" before the {searchTerms} seems to be breaking an exact match search, for example, if I used double quotes and two search terms as "cloud computing", zero results are displayed. Anyone see this behavior? Jun 2, 2017 at 18:16

3 Answers 3


Try to wrap it in {? }

{?{searchTerms} (contentclass:STS_ListItem OR IsDocument:True)}
  • 1
    This worked for me as well. Is the question mark in the documentation at all? I can't seem to find it. Oct 4, 2014 at 3:25
  • Nope - you Can see it sometimes in a preconfigured webpart. You can read more about it in Mikael's awesome series: melcher.it/s/2R Oct 4, 2014 at 6:56
  • 2
    Thanks Matt! Even 2 years later, you are still helping people!
    – user53667
    Apr 26, 2016 at 13:59
  • Haha - thanks for that one mate. And can call me Matt if you want :) Apr 26, 2016 at 21:17
  • I'm trying to do something similar with queries...but ran into a glitch... if you try to use this syntax in the Result Sources queries... it looks like things break... I think because by default, when you build the query there, it slaps on the -ContentClass=urn:content-class:SPSPeople to the end of the query string, no matter how you type things in... have you seen that before...or know a fix?
    – Carp
    Jun 15, 2016 at 15:29

If you set the Query Transform like, it will not load the results on page load.

{?{searchTerms} Path:https://my.sharepoint.com/sitename/Shared%20Documents}
  • Same for me! any idea how to get this working with the "?" Jan 9, 2019 at 15:37

Still relevant with SP 2019 On-Prem
The filter by Content Type worked with this wrapper

    {? ContentTypeId:0x01001E2AEAE841DFF045A38B3ED40E0C46C7* {searchTerms} 
    (contentclass:STS_ListItem OR IsDocument:True)}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.