Configuring the Lightning Conductor Search rollup

Details about configuring the Search Data Source in the Lightning Conductor SPFx modern web part

The Lightning Conductor Search Rollup Engine Provider uses a SharePoint search query to return the results from SharePoint lists and libraries. Search has the advantage of performance over the object model since it uses cached content from the Search Index. The Search rollup provider can return security-trimmed content from multiple scopes up to Tenant scope. You can begin to learn about using the Search rollup in this video on our website. 

This article contains more detailed documentation about configuring this option in the Lightning Conductor.

When the Search Rollup Engine Provider is selected on the Web Part tab, then the Data Source tab allows you to create your search query which is used by the search engine to decide the content returned to the app. The result of the search query is then the data you manipulate on the Columns and Display tabs to decide what and how the app displays the data on the page.

*The Search Rollup Engine should be selected when aggregation performance is an issue when using the Object Model Rollup Engine Provider. You must select one result source in the Search Query section.

Tip: To see examples of the Search configuration, use the ‘Quick Configuration’ mode within the Lightning Conductor, choosing a search scope. Then visit the Advanced Mode for the configured view to learn from the configuration.

You configure your search query using the two sections:

  • Search Query
  • Query Template Variables

You can refine the content returned by the search engine by configuring filters on the Columns tab, however, from a performance perspective, it is better to reduce the amount of content returned from the search engine than to get the Lightning Conductor app to filter the content. However, configuring the search query to return the exact source of data you require can be difficult and you may need help from a search expert to create a search query. Therefore, if performance of the search query is not an issue, refine the search results using the Columns tab.

Search Query

Use this section to select a Result Source, such as Documents, and optionally refine the search results using the Query text list to build a search query, and if the Result Source has predefined variables, using the Query Template Variables section. You can also use the Search Query section to define the Query timeout, use query rules, limit the number of items returned, and to disable query stemming.

Result Source

Result sources define the source or subset of the content that the search query uses to look for results. Result sources replace “search scopes” in previous versions of Microsoft SharePoint®.

When the pre-defined results sources do not meet your requirements, then depending on your permission level, you can create your own result sources; see this Microsoft documentation for details.

For example, when you want to aggregate only documents, select Documents in the Result source list, or if you want to roll up content associated with a specific content type, select Items matching a Content Type. You can also specify the ID of a result source that you have created.

Many result sources allow you to further refine the content returned by configuring query template variables. For example, if you want to return only documents from a specific site, you would select a result source of Documents and then in the Query Template Variables section set the Scope variable to the site. Or, if you want to return only invoice documents, you would select a result source of Documents, and then in the Query Template Variables section set the Tag variable Content Type Name, to, say, Invoices. You do not have to use the query template variables. Then all content from the result source is returned.

Microsoft 365 provides 16 pre-configured result sources:

  • Conversations Discussions in microblogs, newsfeed posts, and community sites.
  • Documents Microsoft Office documents and PDF documents.
  • Items matching a content type Items that match a content type that the incoming query specifies.
  • Items matching a tag Documents or list items that match a managed metadata term that the incoming query specifies.
  • Items related to current user Documents or list items that are related to the user in a way that the query template specifies.
  • Local People Results People items from the profile database of the User Profile service application.
  • Local Reports and Data Results Excel, Office Data Connection (ODC), or Report Definition Language (RDL) items, or items in a report library.
  • Local SharePoint Results All items from the local SharePoint search index except People items.
  • Local Video Results Videos.
  • Pages SharePoint web pages.
  • Pictures Photos and images.
  • Popular Documents and list items sorted by view count.
  • Recently changed items Documents and list items sorted by Modified date.
  • Recommendations Documents and list items that you recommend for the incoming query.
  • Wiki SharePoint wiki pages.

You can view details about the pre-defined result sources from the Manage Result Sources page, which can be found by navigating to the SharePoint admin center and clicking search on the Quick Launch.

Query Text

Use the Query text area to further refine the content returned from the search query if you wish. By default the Query text box contains the search query (contentclass:STS_ListItem OR IsDocument:True), which means that details of all list items and files from the result source are returned in the search results. You can modify this search query by using the Query text list and then clicking Add Query Part or by typing your own queries into the text box, using Keyword Query Language.

The Query text list displays the query variables: Name of current userUrl of current site collectionreturn only itemsreturn only sitesreturn only lists and libraries.

You can specify other text by clicking More to display the Select Value dialog:

  • Select a Value type: Query Variable, Content Type Name, Content Type ID or Site URL.
  • Select a variable from the Choose variable list.
  • Click Select to return to the Data Source tab.

Once you have selected an item from the Query text list, click Add Query Part to add the query to the text box below the Query text list, thereby building up your search query.

You can use the Query Text to specify the scope of a Search rollup by using the path parameter:

path:"YourSiteURL"

This could be one or more sites, lists, or libraries. Here's an example:

Query Timeout

Use to set the amount of time before the query request times out.

Use Query Rules

Select this check box if you want the Lightning Conductor app to use query rules. Query rules can improve the relevance of the search results by promoting results, providing result blocks, or changing the ranking of the results. An example would be to use ‘Promoted Results Contains’ to specify a value to show promoted search items. By clicking the query rules link you will be redirected to the site’s Manage Query Rules page. Query rules can be managed at the tenant, site collection, or site levels.

Item Limit

Use to set the maximum number of items returned in the search results. Using this property you cannot exceed Microsoft’s Search limits for SharePoint Online.

Disable Query Stemming

A Query Stem would be similar words (stemming from the search word). For example, searching for the value ‘Fished’ may return ‘Fisher’. This is an option that you can disable in the Lightning Conductor.

Enable multi geo

Enables support for Multi-Geo Search if your tenant is Multi-Geo. If you are using a Multi-Geo tenant, each tenant will have its own search index. Enabling Multi-Geo will therefore use other Geos to perform the search in addition to the local Geo.

Retrieve all items

By default the search rollup engine only retrieves data page by page, and if there are any filters that must be applied after retrieving the data, those filters might filter out some or all of the items on a page. So there could be situations when a page will not contain any items. 

To resolve this (if filters must be used), enable the Retrieve all items option. In that case, instead of retrieving items page by page, the search engine will retrieve all possible items, then it will filter them using filters after data retrieval, then it will spread the remaining items among pages. In that case there will not be empty pages. However, when enabling this option, the search rollup can take longer, because instead of retrieving just the current page's items, the Lightning Conductor search engine must retrieve all possible items (satisfying the filters applied during data retrieval). The actual performance decrease depends on how many total items must be retrieved. 

Audience targeting

Enabling Audience Targeting will force the Lightning Conductor search rollup engine to retrieve only those items (which are configured as audience-targeted) for which the current user belongs to the targeted audiences. If you enable Audience Targeting, another option will appear: Include not targeted items, which will force the rollup engine to also retrieve all items that are not targeted at all.

Query Template Variables

This section lists the query template variables that can be used by the result source. Setting variables is optional, and when used reduces the data returned from result source.

The variables that can be used with the pre-configured result sources are automatically displayed in this section. You may need to add variables for result sources created by you or other users. Type a name in the Variable name text box, and click the plus icon.

*Clicking Remove will only delete variables you added.

To set a variable, either type the value of the variable in the text box, or click the ellipses button to display the Select Value dialog, which displays different options depending on the type of variable, for example:

  • Many of the pre-defined result sources use a variable named, Scope. The Select Value displays a tree view, allowing you to select the scope for the result source.
  • When the pre-defined result source use a variable named, ContentTypeId, then the Select Value dialog provides a list on content types.

For the 16 pre-configured result sources, the query template variables are listed in the following table:

Result source Variable name
Conversations No variables needed
Documents Scope, Tag
Items matching a content type ContentTypeId, Scope, Tag
Items matching a tag Scope, Tag
Items related to current user ContentTypeId, Scope, Tag, User
Items with same keyword as this item ListItem.Keyphrases, ListItem.QuotedUrl, Scope
Local People Results No variables needed
Local Reports and Data Results No variables needed
Local Video Results Scope, Tag
Pages Scope, Tag
Pictures Scope, Tag
Popular ContentTypeId, Scope, Tag
Recently changed items Scope, Tag
Recommended items ContentTypeId, RecsUrl, Scope
Wiki Scope, Tag

For example, if you select the Documents Result Source, then the Query Template Variable section will look like this:

The default Scope is the entire Tenant, so a common scenario is to limit the scope by clicking on the '...' next to the Value field, to select a specific site. If you need to set a more granular scope, you can do that in the Query Text (see the example above).

If you select Items matching a content type as your Result Source, then the Query Template Variable section will look like below, and you can click on the '...' to select the desired Content Type (e.g. Document, Task, etc) from a dropdown list.

*Tip: When you want to limit the search results to a specific content type, and the Select Value dialog box does not show the required content type, then you can quickly find the content type id by clicking Site content types under Web Designer Galleries on the Site Settings page. Hover over the content type, for example, Document, then in the browser status bar you will see the code: javascript:GoToPage('\u002f_layouts/15/ManageContentType.aspx?ctype=0x0101');

The ContentTypeID for the Document content type is 0×0101.

 

After configuring the Data Source tab, you will use the Columns tab to select which Search Managed Properties to display.

References

Manage Search Result Sources

Keyword Query Language

 

Published Nov 30, 2022