Oct 06 2017 07:45 AM
For the first time I do some testing using pnp.sp.search.
My first simple test is like this:
pnp.sp.search("SharePoint").then((result : SearchResults)
Now I want to convert an api search to pnp. My query is like this:
https://blabla.sharepoint.com/sites/test/_api/search/query?querytext='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
Oct 07 2017 08:41 AM
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.
Oct 09 2017 01:51 AM
Hi @Patrick Rodgers. I tried this but it looks like I'm doing something wrong.
pnp.sp.search(<SearchQuery>{ Querytext: "ContentType:TEST_matters&refinementfilters=RefinableString18:equals("false")", RowLimit: 10, EnableInterleaving: true, }).then((r: SearchResults)
Can you help me out here?
Thanks
Oct 10 2017 03:15 AM
SolutionGot it!! I tried to put the filter in the querytekst. Seems to be a wrong approach. This is the working code:
pnp.sp.search(<SearchQuery>{ Querytext: "ContentType:TEST_matters", RowLimit: 10, EnableInterleaving: true, RefinementFilters: ["RefinableString18:equals('false')"], }).then((result: SearchResults) =>
Oct 10 2017 03:15 AM
SolutionGot it!! I tried to put the filter in the querytekst. Seems to be a wrong approach. This is the working code:
pnp.sp.search(<SearchQuery>{ Querytext: "ContentType:TEST_matters", RowLimit: 10, EnableInterleaving: true, RefinementFilters: ["RefinableString18:equals('false')"], }).then((result: SearchResults) =>