microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
380 stars 338 forks source link

Two results web parts, one as filter. When clicking a different page on the second clears the selection in first. #3114

Open t-ks1234 opened 1 year ago

t-ks1234 commented 1 year ago

Version used 4.9.0

Describe the bug I'm using two results webparts connected together. The first one shows a list where you can select a list item. This acts as a filter to the second using a refinable string. The second shows results from a Document Library. When an item is selected in the first it correctly displays the items in the second for that item. When you click on a different page in the second though it clears the selection in the first and shows results for all items in the second. It looks as though both webparts are refreshed.

To Reproduce Detailed steps to reproduce the behavior:

  1. Add a PNP Results webpart to a new page.
  2. Configure it to display a list's list items. We created some test Customer list items with the customer name in the title. Example KQL - path:https://xxxx.sharepoint.com/sites/Test123/Lists/ListA AND SPContentType:"Item"
  3. Title is the only field in the list we had data in and is the only selected property we used for this webpart.
  4. Set the Layout to Cards and flip on Allow item selection.
  5. Configure a document library on the site to have a managed metadata column with terms that match the titles from the list items in 2. We called it Customer. Copy test docs in there and set the managed metadata on the docs to a term. Make sure you have a few docs with the same term. Index the list.
  6. Configure refinablestring00 or 01, 02, ... managed property to point to the crawled property of the managed metadata column you created. Ours pointed to ows_taxid_customer.
  7. Add a second PNP Results webpart to the page.
  8. Configure it to display documents from the document library. EXAMPLE KQL - Path:https://xxxx.sharepoint.com/sites/Test123/Lib1 AND IsDocument:1
  9. Add refinablestring00 or 01, 02... to the selected properties.
  10. Set layout as detailed list.
  11. Set "connect to a search results web part" to PnP - Search Results as source, field as Title and destination as Refinablestring00 or 01, 02...
  12. Set the Paging options so "Show paging" is on and number of items is 1. This is set to 1 to force it to make pages if you only put say two docs with the same term so we are able to change pages for the test.
  13. Save as draft.
  14. In the first results web part select a list item that has a title that you set as the term on multiple docs. The documents in the second results web part should then only show those docs (you could add a visible column to the results showing the refinablestring00, but I haven't detailed this).
  15. Click on one of the paging options like page 2 in the second results web part. Both webparts should refresh and the selection in the first disappears. The second will then show all documents rather than the filtered results.

Expected behavior When clicking one of the page options in the second web part, the selection in the first results web part should remain and the next page of results should show in the second results web part.

Screenshots Connection image from second web part image

kasperbolarsen commented 1 year ago

I'll try to see if I can recreate this issue sometime this week.

Very nice issue report BTW, thanks 😊

kasperbolarsen commented 1 year ago

I can recreate the issue and can add the following observations: The selected layout for the Master result web part does not matter, both Card, List and Details List are reloaded once the paging is clicked.

kasperbolarsen commented 1 year ago

The best workaround could be to replace the Master result web part with a Search Filter web part showing the RefinableString , like this: (unless it is very important that the "filter" should be a button like component). The Search Filter does retain the selected value on paging :-)

image

t-ks1234 commented 1 year ago

Thanks for the testing, @kasperbolarsen. Unfortunately, having the button style look is a requirement for this project.

kasperbolarsen commented 1 year ago

If that is a must-have requirement you will have to make a choice: 1) Locate the issue and create a PR and build your own version of the project while waiting for a new release. 2) Wait for somebody to fix the issue, and that might take a long time or perhaps never as this issue is an edge case. (this is an Open Source project and does not have any kind of SLAs) 3) Create your own project specific SPFx web part that does exactly what you need.

t-ks1234 commented 1 year ago

We have cranked up the file list to show 100 files now in the second web part. The users seem to be happy with that for now. Waiting for 2. if it ever happens is fine, until they change their mind. Then I'll investigate 1. and 3. Thanks for the options, @kasperbolarsen.