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
385 stars 338 forks source link

Filter webpart customization for filter items #225

Closed Georg-Trixl closed 1 year ago

Georg-Trixl commented 4 years ago

Is your feature request related to a problem? Please describe. In my company we have highly customized search refiners, those refiners change the content while rendering. We expose as refiner SharePoint internal information (like WebTemplate) to our users and the customized refiners are translating the values "it self speaking" values. For example we translate in classic search things like GROUP | Work site BLOG | Blog site STS | Work site ... and so on.

On the other side in classic refiners are the file types more elegantly solved. _function mapResultType(listData) { var map = { }; map[Srch.U.loadResource("rf_ResultTypeRefinerValueMSAccess")] = { "RefinerName": "FileType", "RefinementValues": ["accdb", "accdc", "accde", "accdr", "accdt"] }; A function like that aggregates more or les files, that are generated by same software into one refiner element, that shows also a more user friendly name like Access.

Describe the solution you'd like Provide the option (a new field) to enter a translation list into each of the refiner rows, in the filter webpart configuration, in order that every result from the search can be translated in a user friendly information. That translation list, should be able to use different input formats like GUID, String etc. and deliver a output string. Possible should also that serveral input items share the same ouput item, with other words, several search results can be aggregated when they have the same output string. As for example output of the Managed Property contentclass:

A format like that would be desirable, first the input from search, second the output from the filter webpart, delimited with a character maybe | (vertical bar). This should also work for all Refiner template's of refiner like "Default refinement item", "File type", "Multi-value refinement item" and so on.

Desired alternatives Enable each filter row to be rendered with a Handlebars script.

Additional context To have such a feature is import to companies that have many search results, which are very similar. Because the AI tools that Microsoft provides to find the content with modern search, does not do the job properly for huge companies with tons of documents.

That is was is rendered in the filter webpart Modern Search Managed Property Raw The same managed property rendered from classic search refiner Classic Search

wobba commented 4 years ago

Good suggestion and will most likely be solved by allowing custom handlebar templates and functions to be used for refiners. It's in the plans, but no specific date as it's not high on the demand list. Feel free to contribute :)

ravinleague commented 3 years ago

Has this been addressed in the latest release ?

wobba commented 3 years ago

Using the custom template option in v4 https://microsoft-search.github.io/pnp-modern-search/usage/search-filters/layouts/#custom you can build this yourself.

Leaving it open as an enhancement in case someone builds a config option for it.

fonbrauzen commented 1 year ago

Could you pls add via Search results to search filters web part ability to use Handlebars customizers? In my case I have the array of numbers, which I want to sort 1, 2, 3, 10 and not like in JS 1, 10, 2, 3. To do this I need a small JS function:

let a = [1 , 10000, 10, 20 ];
a.sort(); //default, incorrect => [1, 10, 10000, 20]
a.sort((a, b) => { return a - b; }) //with sort function, => [1, 10, 20, 10000]      TODO as HandleBars customization

According to your docs, currently, it's not possible.

Georg-Trixl commented 1 year ago

To me is that feature request closed, as that was based on the old version 3 of PNP Modern Search and in our company we have moved the most of our PNP Modern Search implementation to V4.

fonbrauzen commented 1 year ago

OK, here is a new feature request