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
390 stars 341 forks source link

Taxonomy Tree view in Filters #1228

Closed kmrshubham0 closed 3 years ago

kmrshubham0 commented 3 years ago

I would like to contribute a specific filter for taxonomy structure. I have seen in many requirements in search filter where they wanted taxonomy to appear same structure how it shows in termstore. So in filter if they users provides in the configuration Refinablestring and termset id. The filter will load the termset structure the same way how it appears in termstore. Not only that it they will have the option to maintain parent child relation. For ex. If A is parent of child B and C. Then when user selects B the result will shown for both B and A. If users select A then the result A,B and C will be shown.

Can you give me the permission to contribute on this requirement. I will document the detailed requirement if above little summary looks good

simonpierre-giro commented 3 years ago

I support this request, that would be an awesome feature

wobba commented 3 years ago

@kmrshubham0 Providing which managed property to target could be optional. You can target Tags where you prepend 0 in front of the guid or just do a free-text search for the guid itself to get results. Also if people use site columns you have the auto mp's you can optionally target without needing to mapping anything (see examples at https://www.techmikael.com/2014/03/s15e01-kql-basics.html). With some random testing it seems the automp is created now regardless of a site column or not(?), but have to verify this.

This means free-text search for the term guid should yield any items tagged with that term or below.

Feel free to fork the dev branch and start a PR. If you want to share the setup UX before starting, you can do that so we agree on the setup approach.

FranckyC commented 3 years ago

Hi @kmrshubham0, that's not a bad idea of course ;). However, it will require several updates to the base code, things I'm not really pleased with given what happened with the v3 version over the years. Anyway, to make this feature complete you will have to consider the following constraints:

Also, due to the current architecture of the refiner Web Part, the taxonomy picker has to be implemented through a web component like other filters, making the component state handling quite challenging. Using the PnP Taxonomy picker control is also not an option as it uses CSOM if I remember correctly.

As you can see, this is not simple as it looks. I strongly suggest you to draft a minimal code implementation in your forked branch for review before going forward with more complex things.

FYI, this feature already exist, but in an other version based on the pnp modern search and it took months to achieve due to this inherent complexity. To give you an idea:

image

image

image

We won't merge something not compliant with the current architecture and expected feature level.

kmrshubham0 commented 3 years ago

Hi @FranckyC,

Thank you for the reply with the suggestion. I have done similar thing in one of my project. What I have done their is like I created my own Custom Refiner filter which reads the configuration from sharepoint list and then shows the tree structure as per the mentioned termset id. In the refiner I am showing the tree structure with the search functionality, meaning if tree is big then search the keyword and it is narrowing down the tree view. And here I am using the same parent child relation. This also works based on the configuration. If in configuration it is mention as Parent Child then it will with this relation or if it selected individual then it will show result for particular tag. In my custom refiner I am using the concept of GP0 & GPP. And this custom refiner I have connected with PnP Modern Search web part of version V3.

I will fork the dev branch will add the things accordingly what you have mentioned. Just wanted check one more thing if i can use PnP-SPFX-Controls or Fluent UI here or not.

What else i am thinking is like for parent child functionality we can update treeview of the PnP spfx control and that control we can use it here. So like this way we will have minimal changes here and there also.

wobba commented 3 years ago

@kmrshubham0 we are already using the PnP reusable controls, and you can use components from office-ui-fabric-react@7.156.0 which is already included in the project. See packages.json for current included packages.

FranckyC commented 3 years ago

What I have done their is like I created my own Custom Refiner filter which reads the configuration from sharepoint list and then shows the tree structure as per the mentioned termset id.

Not sure I get it but anyway, using a sharepoint confiugraiotn list is not an option in this scenario for the modern search. If you want to use the PnP control (which I'm not a fan), you should of course do your modifications directly in the https://pnp.github.io/sp-dev-fx-controls-react/ repository and integrate it with the modern search following the requirements mentioned above.

HamEv commented 3 years ago

Hi, I just to ask about that sentence: "FYI, this feature already exist, but in an other version based on the pnp modern search and it took months to achieve due to this inherent complexity."

In which version does that exist? I cannot find the a Taxonomy tree in v3, but that would be a great feature.

FranckyC commented 3 years ago

Hi @HamEv , see https://aequos-solutions.github.io/modern-data-visualizer/features/

kmrshubham0 commented 3 years ago

I will start on this soon.