SOLVED > syntax question (from SharePoint search API URL to PnP)'ContentType%3ATEST_matters'%26amp%3Brefinementfilters%3D'RefinableString18%3Aequals(%22false%22)'%3C%2FPRE%3E%3CP%3EI've%20done%20some%20searching%20on%20the%20internet%20to%20find%20the%20syntax%20to%20covert%20this%20to%20pnp%20but%20no%20luck%20so%20far.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20how%20do%20I%20change%20my%20querystring%20in%20order%20to%20get%20it%20working%20with%20PnP%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%20Mike%3C%2FP%3E%3C%2FLINGO-B!!'false')%22%5D%2C%0A%20%20%20%20%20%20%7D).then((result%3A%20SearchResults)'
Regular 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 (Regular 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) =>