Pnpjs: Search Query with Refinement Filters - string vs array

Created on 18 Sep 2018  路  5Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [*] Bug
  • [ ] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [ @pnp/[email protected] ]

Expected / Desired Behavior / Question

When using sp.search and the SearchQueryBuilder to query search with refinement filters using an array with 1 string value, the array format should translate as such correctly to the request body ( RefinementFilters > results > array of 1 string )
image

Observed Behavior

When using sp.search and the SearchQueryBuilder to query search with refinement filters using an array with 1 string value, the array format does not translate as such correctly to the request body ( RefinementFilters > results > string )
image

Steps to Reproduce

  1. Build a search query using SearchQueryBuilder.
  2. Set the refinement filters using .refinementFilters("myRefinementFilter")
    image
  3. Convert to a search query using .toSearchQuery()
  4. Initiate the query using sp.search(searchQuery)
  5. Observe the post request body in the browser dev tools
code fixed bug

Most helpful comment

Not proficient with GitHub pull requests and didn't manage to use this PR in my project without a bunch of errors, I'm probably doing it wrong (I used GitHub desktop to get the version with the specific pr, then "linked" to that repo's individual packages folder).

I'll wait for the 1.2.2 release :). Thx for the quick reply & action!

All 5 comments

I don't have this issue with @pnp/[email protected] and relevant common/odata packages of the same version

Can you share the code you are using that generates this error? Thanks!

Nevermind, I see what happened here. Sorry about that, it is a regression from refactoring the SearchQueryBuilder. Working on a fix.

If you get a chance can you pull down and test the fix in this PR? I think this is resolved in that change.

Not proficient with GitHub pull requests and didn't manage to use this PR in my project without a bunch of errors, I'm probably doing it wrong (I used GitHub desktop to get the version with the specific pr, then "linked" to that repo's individual packages folder).

I'll wait for the 1.2.2 release :). Thx for the quick reply & action!

Was this page helpful?
0 / 5 - 0 ratings