SharePoint Lists and Libraries with Search

This post will explore how to configure the Lightning Conductor’s Search Rollup Engine Provider to aggregate SharePoint List and Library content from across your SharePoint environment.

Lightning Conductor SPFx Getting Started.

The Search Engine Rollup Provider provides relatively better aggregation performance than the Object Model. However, the tradeoff is that the results from the Search Engine are based on the last SharePoint Search Index refresh, as opposed to aggregated results from the Object Model, which are obtained in real-time.

SEARCH ROLLUP ENGINE PROVIDER

As in the Object Model, you can use either the Quick Configuration or the Advanced Mode to build a view of aggregated content. The Quick Configuration is a fast way of rolling up typical content, including tasks and documents, while the Advanced Mode allows you to be more granular with other settings.

In the Quick Configuration, you can select the data source from any source marked as Search Engine. As mentioned, the difference between them and the Object Model real-time queries is a relatively higher performance but with the tradeoff of rolling up only cached content.

When the Search Rollup Engine Provider is selected on the Web Part tab in the Advanced Mode, then the Data Source tab allows you to create your search query, which the search engine uses to decide the content returned to the app. The search query results are the data you manipulate on the Columns and Display tabs to determine what and how the app displays the data on the page.

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 the 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. When the pre-defined results sources do not meet your requirements, then depending on your permission level, you can create result sources at:

  • All site collections within the environment using the SharePoint admin center.
  • All sites within a site collection using the Search Result Sources link under Site Collection Administration on the Site Settings page when you are a site collection administrator.
  • A single site using the Result Sources link under Search on the Site Settings page when you are a site owner.

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 will 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.

There are currently 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.
  • Items with same keyword as this item: Results sharing a keyword with a given item.
  • Local People Results: People results from the Profile Database.
  • 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 under More Features.

QUERY TEXT

Use the Query text area to further refine the content returned from the search query. 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, value from data source.

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.

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. 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.

RETRIEVE CURRENT PAGE ITEMS

When the option of retrieving current page items is enabled and current display settings support pagination, then only current page items will be retrieved by the Search Engine when navigating to a certain page. Otherwise, the Search Engine will retrieve all items. When using pagination and filtering/sorting by such columns which are not filterable/sortable by the Search Engine, then this option must be turned off to get correct results on each page.

QUERY VARIABLES

This section lists the query template variables that the result source can use. 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 you or other users created. Click the + cross icon and type a name in the Variable name text box.

To set a variable, either type the value of the variable in the text box, or click the ellipse 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 source use a variable named, Scope. The Select Value displays a tree view, allowing you to select the scope for the results 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 pre-configured result sources, some of 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

Was this article helpful?

Can’t find what you’re looking for?

Our world-class Customer Success team is here for you.

Contact Support