Skip to content

Commit

Permalink
Merge pull request #4229 from microsoft-search/develop
Browse files Browse the repository at this point in the history
v4.16
  • Loading branch information
wobba authored Feb 18, 2025
2 parents 0747bdd + ef11d57 commit 11d1ba5
Show file tree
Hide file tree
Showing 67 changed files with 715 additions and 585 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
site/*
site/*

# Mac files
.DS_Store
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Display Multilingual term store values with PnP Search Results

!!! note
The PnP Modern Search Web Parts must be deployed to your App Catalog and activated on your site. See the [installation documentation](../installation.md) for details.

This scenario describes how term store values can be displayed in multiple languages in the PnP Modern Search.

## Prepare the scenario
I use the colours as example in my case, it's simple to understand in different languages. You need also 2 different users with different language settings for a quicklier testing.

Create a SharePoint Term store and translate the terms into another language, i use english as a default language and german as work language. Translate every term within the term set.
![Create a SharePoint term set](assets/display-multilingual-term-store-values-with-pnp-search-results/create-a-sharepoint-term-set.png)

Create a SharePoint site column with type Managed Metadata and use the newly created term set.
![Site column Managed Metadata](assets/display-multilingual-term-store-values-with-pnp-search-results/site-column-managed-metadata.png)

Add the new site column to a SharePoint document library and tag your documents.

When you check the library with your 2 different users, you can see SharePoint will be translate the multilingual term sets in the language from the user, where is logged in. SharePoint will be translate all default terms also in the other language, but not columns or views, but you can translate this terms manually.

Library in english:

![Document library in english](assets/display-multilingual-term-store-values-with-pnp-search-results/document-library-in-english.png)

Library in german:

![Document library in german](assets/display-multilingual-term-store-values-with-pnp-search-results/document-library-in-german.png)

As prepare for our search configuration, map the new crawled property to RefinableStringXX Managed Properties, please attention, map both Crawled properties, OWS_ and the OWS_TAXID_, to Managed Properties.
![Managed properties RefinableString](assets/display-multilingual-term-store-values-with-pnp-search-results/Managed-Properties-RefinableString.png)

Now, we are ready to jump into our search scenario, let's go 🚀

## Add PnP Search Results WebPart to a page
Add the PnP Search Results WebPart to a new or existing site page. See the scenario how you can [create a simple search page](create-simple-search-page.md)
![Add PnP Search Result WebPart](assets/display-multilingual-term-store-values-with-pnp-search-results/add-pnp-search-results-webpart.png)

## Configure Search Results WebPart
Configure the new PnP Results WebPart with a SharePoint Search source and as simply as possible, with a path-query and add the new Managed Properties as Selected properties in the WebPart configuration.
![Configure PnP Search Result WebPart](assets/display-multilingual-term-store-values-with-pnp-search-results/results-webpart-confguration.png)

Add the new Managed Property, with the OWS_, as Managed columns into the results WebPart and save the page.
![Configure PnP Search Result WebPart - Managed columns](assets/display-multilingual-term-store-values-with-pnp-search-results/webpart-configuration-manage-columns.png)

Check the page with both users and different language settings and you can see, the terms will NOT translate into the languages, we can see the default language as column values.

![Search Results without translation](assets/display-multilingual-term-store-values-with-pnp-search-results/search-results-without-translation.png)

## Configure multilingual columns
Edit the page and go back to Manage columns, activate the Use Handlebar expression and insert {{AutoRefinableString127}} , the second property mapped to the crawled property OWS_TAXID_, as expression.
![Add AutoRefinableString as Handlebar expression](assets/display-multilingual-term-store-values-with-pnp-search-results/webpart-configuration-manage-columns-ows_taxid_.png)

Enable localization on the first page from the PnP Search Results configuration.
![Enable localization](assets/display-multilingual-term-store-values-with-pnp-search-results/enable-localization.png)

## Testing Search configuration
After saving the configuration, now you can see the translated values in the PnP Search Results WebPart in the different languages.

### Results in english
![Multilingual Search Results in English](assets/display-multilingual-term-store-values-with-pnp-search-results/results-in-english.png)

### Results in german
![Multilingual Search Results in German](assets/display-multilingual-term-store-values-with-pnp-search-results/results-in-german.png)

*A little multilingual disclaimer: The search columns or SharePoint WebPart titles are not multilingual, but you can use SharePoint Multilingual Pages to configure more in a different language. See more in the Microsoft article: [Create multilingual SharePoint sites, pages, and news](https://support.microsoft.com/en-us/office/create-multilingual-sharepoint-sites-pages-and-news-2bb7d610-5453-41c6-a0e8-6f40b3ed750c?WT.mc_id=DX-MVP-5004845)
3 changes: 3 additions & 0 deletions docs/scenarios/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ Showing the work anniversaries of employees is a common request in any intranet.

## [Connect one Search Results web part to another Search Results Web Part](Connect-to-a-search-results-webpart.md)
This scenario describes how to connect more then one results Web Part together. One results Web Part will view the sites, connected with the current HUB site, the other, connected results Web Part, will show the documents from the selected site.

## [Display Multilingual term store values with PnP Search Results](display-multilingual-term-store-values-with-pnp-search-results.md)
This scenario describes how term store values can be displayed in multiple languages in the PnP Modern Search.
2 changes: 2 additions & 0 deletions docs/usage/search-results/data-sources/microsoft-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ The _'Microsoft Search'_ data source retrieve items from the Microsoft search en
| **Enable spelling modifications** | Flag to enable spelling modifications. If enabled, the user will get the search results for the corrected query in case of no results for the original query with typos. The response will also include the spelling modification information in the **queryAlterationResponse** property. |**false**
| **Sort settings** | Configure the sort settings of the data source. Properties listed in the dropdown are all static properties marked as _'Sortable'_ in the [SharePoint search schema](https://docs.microsoft.com/sharepoint/technical-reference/). However, it does not list all possible _RefinableXXX_ or aliases fields. To use them, you must enter the value manually and press 'Enter' to validate. For a particular field, you can define if it should be used for initial sort (i.e. when the results are loaded for the first time) or be only available for users in the sort control (i.e. after the results are loaded). **The sort control does not consider default sort fields (i.e. select them by default) and you can only sort on a single field at a time according the fields you defined**. If no user sort fields are defined in the configuration, the sort control won't be displayed. | None.
| **Enable result Types** | Display results according to the result types defined in the Microsoft Search admin center. **This option can only be used if `External Items` entity type is selected and the layout type is "Adaptive Cards** | None.
| **Show SharePoint Embedded (hidden) in search results** | By default content in SharePoint Embedded Containers is not [visible](https://learn.microsoft.com/en-us/sharepoint/dev/embedded/concepts/content-experiences/search-content) in Microsoft Search. Add the relevant ContainerTypeids to the query template, like ContainerTypeId:"1adc34ca-aef3-4e13-aacf-39b43affd198" and the contain is now returned. | None.
| **Show MS Archived content in search results** | By default contain archived with Microsoft Archive is hidden from Microsoft Search, but this option sets the required "includeHiddenContent" and "isArchived" properties, which ensures that the contant is now returned by the API. | None.
1 change: 1 addition & 0 deletions docs/usage/search-results/layouts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ For all layouts, some common settings are available:
| ------- |---------------- | ---------- |
| **Allow items selection** | If enabled, allow items to be selected in default layouts. See [documentation](../connections/item-selection.md) for usage. | Disabled.
| **Allow multiple selection** | If the item selection is allowed, specify if users can select multiple items | Disabled.
| **Preserve selection on empty click** | If the item selection is allowed, specify if a click outside of the selection zone should clear the selection | Disabled.
| **Hide this web part if there's nothing to show** | If there is no results, the Web Part will remain blank in display mode (title and 'See all' link included). In edit mode, you will see a message indicating there is no results. <p align="center">!["Common options"](../../../assets/webparts/search-results/layouts/hide_webpart.png)</p> | Disabled.
| **Show results count** | Hide or display the results count for the current query. | Enabled.
| **Use Microsoft Graph Toolkit** | Enable or disable the Microsoft Graph Toolkit to be used in Handlebars template. Refer to the [MGT documentation](https://docs.microsoft.com/en-us/graph/toolkit/overview) to see available components.
Expand Down
2 changes: 1 addition & 1 deletion search-parts/config/package-solution.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"solution": {
"name": "PnP Modern Search - Search Web Parts - v4",
"id": "59903278-dd5d-4e9e-bef6-562aae716b8b",
"version": "4.15.0.0",
"version": "4.16.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
Expand Down
12 changes: 12 additions & 0 deletions search-parts/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ const envCheck = build.subTask('environmentCheck', (gulp, config, done) => {
"fs": false
};

// Remove the default html rule
generatedConfiguration.module.rules = generatedConfiguration.module.rules.filter(rule => {
return rule.test.toString() !== '/\\.html$/';
});

generatedConfiguration.module.rules.push({
test: /\.js$/,
include: [
Expand Down Expand Up @@ -100,6 +105,13 @@ const envCheck = build.subTask('environmentCheck', (gulp, config, done) => {
test: /index\.js$/,
include: [/spfx-controls-react[/\\]lib[/\\]controls[/\\]HoverReactionsBar/],
loader: 'ignore-loader',
}, {
// Add html loader without minimize so that we can use it for handlebars templates
test: /\.html$/,
loader: 'html-loader',
options: {
minimize: false
}
});

generatedConfiguration.optimization.splitChunks = { cacheGroups: { vendors: false } };
Expand Down
Loading

0 comments on commit 11d1ba5

Please sign in to comment.