SOLVED > syntax question (from SharePoint search API URL to PnP)

Iron Contributor

For the first time I do some testing using 

My first simple test is like this:"SharePoint").then((result : SearchResults)

Now I want to convert an api search to pnp. My query is like this:'ContentType:TEST_matters'&refinementfilters='RefinableString18:equals("false")'

I've done some searching on the internet to find the syntax to covert this to pnp but no luck so far.


So how do I change my querystring in order to get it working with PnP?


Thanks, Mike

3 Replies

You can pass a plain object of the search properties from the query string into the search method. You can check the wiki page on search to help get you started.

Hi @Patrick Rodgers. I tried this but it looks like I'm doing something wrong.<SearchQuery>{    Querytext: "ContentType:TEST_matters&refinementfilters=RefinableString18:equals("false")",
    RowLimit: 10,
    EnableInterleaving: true,
}).then((r: SearchResults)

Can you help me out here?


best response confirmed by Mike Jansen (Iron Contributor)

Got it!! I tried to put the filter in the querytekst. Seems to be a wrong approach. This is the working code:<SearchQuery>{
      Querytext: "ContentType:TEST_matters",
      RowLimit: 10,
      EnableInterleaving: true,
      RefinementFilters: ["RefinableString18:equals('false')"],
      }).then((result: SearchResults) =>