Content Search web part in SharePoint Online

In this SharePoint Online search tutorial, we will discuss the SharePoint content search web part. We can use the same content search web part in SharePoint Online/2013/2016. Also, we will see advantages of content search web part over content query web part in SharePoint. How to add and configure content search web part in a SharePoint Online web part page. I will also show few properties available in the content search web part in SharePoint Online.

Apart from this, we will also see how to use SharePoint online search web part and configure sharepoint online search web part.

Content search web part in SharePoint Online/2013/2016/2019

Microsoft introduced the content search web part in SharePoint 2013, by that time content search web part was also available in SharePoint Online.

By using the content search web part, you can display search results that can be easily formatted by using a custom display template. Behind each content search web part, there is a search query associated which provides the search results.

Display templates consist of HTML & JavaScript that decide the look and feel of the search result associated with the web part.

Advantages of SharePoint content search web part over content query web part

I have written an article on SharePoint 2013 content search web part vs content query web part. Read the article to know more about where to use the content search web part and where to use the content query web part in SharePoint Online or SharePoint 2016/2013.

Add and Configure SharePoint content search web part

Let us see, how to add SharePoint content search web part to a SharePoint web part page and we will also, see how to configure content search web part in SharePoint Online.

To add a Content Search Web part, First of all, open your web part page. Then click on “Add a Web Part” on the specific zone from where you want to add the web part.

Click on “Content Rollup” from the “Category” template and then click on “Content Search” web part as shown in below.

content search web part sharepoint online
content search web part sharepoint online

This is how to add a content search web part to a SharePoint Online site.

Now, we will see how to configure SharePoint Online content search web part with a few examples.

Example-1: Displaying Picture library items using Content Search web part

Once the “Content Search” web part will add to your existing web part page, follow the below processes for displaying the picture with the image sliding:

Click on the drop-down symbol which is present at the right side of the Content Search web part. Click on “Edit Web Part” from that dropdown to edit the web part properties.

sharepoint 2016 content search web part
sharepoint 2016 content search web part

In the “Properties” page, Click on “Change query” as shown in below.

sharepoint 2013 content search web part
sharepoint 2013 content search web part

In the “Build Your Query” page, Select the “Basics“. From the “Select a query” field, Select “Picture(System)” from the drop-down.

content search web part list items
content search web part list items

Again go to the “Refiners” tab, select the Picture from the “Content type“. On the right-hand side, we will see all the pictures of the SharePoint site. Then click on “OK“.

content search web part list items
content search web part list items

Now select the number of items which you want to show on the web part page. In the “Display Templates“, select the “Control” as “Slideshow” and next in the Item, Select the picture size as per your requirement.
Here, I have selected the “Item” as “large Pictures“.

Once all the Display Templates field value will over, Click on “Apply” and then “OK” as shown in below.

content search webpart in sharepoint online
content search webpart in sharepoint online

While you will click on “Stop Editing” mode from the ribbon, then the output screen will look like below. As per my requirement, the SharePoint online picture library items are coming in the image slider mode as like below screenshot.

content search webpart in sharepoint 2013
content search webpart in sharepoint 2013

Example-2: Display SharePoint Online List Items using a Content Search web part

In this SharePoint search tutorial, we will discuss how to display all SharePoint Online list items using a content search web part. By using the content search web part, you can display search results that can be easily formatted by using a custom display template.

In my SharePoint Online site, there is a list as “Demo Product Details” which has below columns.

  • Title
  • ProductDetails
  • ProductName
  • ProductManinImage

I want to display the “Title”, “ProductPicture”, “ProductName” and “Product Details” in the SharePoint web part page using a Content search web part.

content search web part list items
content search web part list items

Here I am using a Publishing site. I have created a web part page and named as “DisplayListItem”.

SharePoint 2013 content search web part
SharePoint 2013 content search web part

Edit the page then add the “Content Search” web part which comes under “Content Rollup” of Categories section.

sharepoint 2013 content search web part
sharepoint 2013 content search web part

When the “Content Search” web part will successfully add to the SharePoint web part page, we will see the items which I have recently modified in the SharePoint site.

sharepoint 2013 content search web part list items
sharepoint 2013 content search web part list items

Display List Items using SharePoint Online Content Search web part

Now we will see how to display list items from a particular list using the “Content Search Web part” in SharePoint Online web part page.

Click on edit web part of the content search web part. Click on the “Change query” below the “Search criteria” like below.

display the sharepoint list uisng content search web part
display the sharepoint list uisng content search web part

The “Build Your Query” page, first check it is in “Advanced mode” or “quick mode”. If it is in “Advanced mode” then “Switch to the Quick Mode” from the right side corner of “BASICS” page. The “Quick Mode” page contains

Select a query : From the dropdown select “Documents(System)”

Restrict by the app: In the “Restrict by app” dropdown field select the “Specify a URL”. One input text box will arise, give the particular list URL in the text box which items you want to retrive.

Restrict by tag : Select “Donot restrict by any tag”.

Go to the “Advanced Mode”.

SharePoint 2013 content search web part
SharePoint 2013 content search web part

In the “Advanced mode” page remove the red column highlighted things, except the list URL delete all the thing in the “Query Text”. Click on “Test Query”

SharePoint online content search webpart
SharePoint online content search webpart

We can see all the list item in the “Relevent Results” in the “Search result preview” click on Ok. Then in the “Properties” page click on “Apply” and “OK”

SharePoint 2013 content search webpart
SharePoint 2013 content search webpart

We can able to see all the list item with the title filed in the web part page.

content search web part list items
content search web part list items

Use SharePoint Online List GUID to display items from a particular list

Now we will see by passing the guid how we will get the Particular list items.

For that first go to the particular list, list settings in the top we can able to see “List=%7B4D42C965-B4C6-46DE-99D4-82B97DAD7E1C%7D” with the list url. From this url we will get our list “GUID”.

convert the %7B to { and %7D to }. So our
“GUID” will be {4D42C965-B4C6-46DE-99D4-82B97DAD7E1C} .

Go to the web part page. Edit the web part. Add the “Content Search web part”. Go for the “Edit” the “Content search web part”. Click on “Change Query” and go to the “Build Your Query” Basics page.

In the “Quick mode page” in the “Select a Query” field select the “Item related to current user”. In the “Restrict by app” field select “Current site”. Now click on “Switch to Advanced Mode”.

display the sharepoint list uisng content search web part
display the sharepoint list uisng content search web part

The “Advanced Mode” contains some of the below field.

Select a query: By default the “Local SharePoint Result(System)” will be selected. If not select the “Local SharePoint Result(System)”.

  • Keyword filter: In the Keyword filter the “Query from the search box” will be selected.
  • Property filter: First click the “Show all managed properties”. Select the “ListID” from the dropdown. In the second dropdown select the “Contains”. In the third dropdown list select the “Manualvalue”. After seleccting the manual value one text box will come give the list “GUID”. Click on “Add property filter”.
  • Query Text: In the Query Text we will see the List ID will be added automatically. To check the Query click on “Test query”. In the “SEARCH RESULT PREVIEW” we can able to see all the SharePoint online list item. Click on OK then all item will appear in the Web part page.
sharepoint 2013 content search web part
sharepoint 2013 content search web part

Display multiple columns in Content Search Web Part

Now we will see how to display more columns on the web part page using the content search web part.

In the below example I am showing you how to display “Title”, “ProductName”, “ProductImage” and “ProductDetails” in the web part page.

Go to “Edit the Web part” page. We can able to see “Property Mappings” option. Below the “Property Mappings”, enable the Check box “Change the mapping of managed properties for the fields in the item display template”.

After we select the text box we can able to see some of the text box field.

  • PictureURL: I have mapped my SharePoint list “ProductImage” site column to PictureURL(managed property). So in the text box I have seleccted from the dropdown “PictureURL”. Already we can able to see the “PictureURL”, if it is not there then add.
  • Link URL: Leave the field as it is. By default the field is selected to Path.
  • Line1: I have selected the title column in the line 1 field.
  • Line2: In the Line 2 I have selected the “RefineableString00(managed property)”. The Product name site column, I have mapped with “RefineableString00”. So i have selected the “Refineable string00” to displying the “ProductName” in the SharePoint web part page.
  • Line3: Like that for the “Product Description I have selected the “RefineableString01(mapped to “Property Mappings”.

Click on “Apply” and “OK”.

display the sharepoint list uisng content search web part
display the sharepoint list uisng content search web part

Below screenshot we can notice in the output the Picture”, “title”, “ProductName” and “Product Details” is displaying.

sharepoint 2013 content search web part
sharepoint 2013 content search web part

Content Search Web Part with Query String in SharePoint Online

Now we will see how to create a query string in the “Content search web part”. Using the Query string we will display the items based on the various search criteria. Here we will see how we will filter the title field from the SharePoint online list using the content search query string filter.

For that, I have created one more content search web part and go to the “Change Query” of SharePoint “Edit Content search web part”.

In the “Quick Mode” in the “Select a query field” select the “Item related to current user(System).

Restrict By App: Give the SharePoint Online list URL below the “Select a query. Go to the “Advanced Mode”.

sharepoint 2013 content search web part list items
sharepoint 2013 content search web part list items

The advanced mode is containing “Select query”, “Keyword filter”, Property filter”and “Query String”.

Leave the “Select Query field, by default it is always “Local SharePoint results(System).

  • Keyword filter: Select the “Value of a parameter from URL”.
  • PropertyFilter: Select the “Title” field. If the field is not available then click on “Show all managed property”, then the title filed will available in the dropdown list. Leave the “Contains” field as it is. In the next drop down select the “Value of Parameter from URL”.

Click on “Add property filter”. In the “Query Text” box automatically query will be added that “Title:{QueryString.MyParameter1}”.We can change the “Myparameter1” name to anything, any name we can give.

content search web part query string
sharepoint 2013
content search web part query string
sharepoint 2013

I have changed the “Myparameter1″ name to title.

content search web part query string

content search web part query string

To display the more field in the content search web part, go to the prooperty mapping filed and add the fields in the text box.

sharepoint 2013 content search web part query builder
sharepoint 2013 content search web part query builder

Copy and paste the below url in the browser.

“https://onlysharepoint.com/sites/oursites/Pages/page name.aspx?title=DoorKnob”

We can able to see all details(ProductName and ProductDetails) about the item whose title value is “DoorKnob”.

sharepoint online content search web part query builder
sharepoint online content search web part query builder

We can add more query string parameter also. In the property filter I have selected the “RefineableString00” which is the managed property which is mapped with the “ProductName”. Click on the “Add Property flter” automatically the query string will be added in the “Query Text”. Change the “Myparameter2” name to “PN”.

Here I am using the and condition when both the condition will satisfy then the only item will show. The condition is (Title:{QueryString.title})(RefinableString00.{QueryString.PN}) which I have put in the “Query text”.

content search web part list items
content search web part list items

See I have written two condition with and so the output is coming. If I will only add the title value then the out put will not show.

SharePoint 2013 content search web part
SharePoint 2013 content search web part

So for that, we can use the or condition. If one condition is true then also item will display. I have added (Title:{QueryString.title}) OR (RefinableString00:{QueryString.PN}) in the “Query text”.

SharePoint online content search webpart
SharePoint online content search webpart

I have added only title field value then also item is displaying.

display sharepoint list using content search web part
display the sharepoint list using content search web part

We were discussed how to display the SharePoint online list items on the web part page using the content search web part. How to display more than one column in the “Content Search” Web part using the content search web part property mapping option.

We were also see how to filter the item from the list using the query string in the web part page using the SharePoint online content search web part.

SharePoint search results web part

Want to know how to display sharepoint search results using an out of box web part in SharePoint Online or SharePoint 2013/2016 or SharePoint? Keep reading to know more on, Search results web part in SharePoint online. We will see, how to display documents created or modified by the current logged-in user using the sharepoint search results web part.

We will see how we can add a SharePoint search result web part to a web part page and configure search result web part to display logged-in user’s documents in SharePoint Online.

Search results web part in SharePoint online

Now we will see how to add a search result web part to a web part page in SharePoint Online.

To add the “Search result” web part, click on “Add a web part” on the web part page in the edit mode. Then click on the “Search Results” web part from the “Search” categories.

Search results web part in SharePoint online
search results in web part SharePoint online

Configure search results web part sharepoint online

Let us see how to configure configure search results web part sharepoint online.

Now we will see how to display all last modified documents by the logged-in user. So for that edit that particular web part properties. In the “Properties for Search Result” page click on “Change query”.

search result web part SharePoint online
search result web part SharePoint online

Now build your Query page will open. In the Advanced mode select the “Documents(System)” from the drop-down. Then switch to the “Quick Mode“.

SharePoint 2013 search results
SharePoint 2013 search results

Quick mode page in the “Query text” add “ModifiedBy:{User.Name}”. Then clicked on “Test Query”, in the “Search Result Preview” we can see all the documents which is the logged in user modefied. Clicked on OK.

SharePoint online search results in the web part
SharePoint online search results in the web part

When we expand the “Settings” from the “Search result properties page” we will get the below option. We can set how many items we want to display on the page. Here I have set to 10 items.

In the down of settings page, we can see the “Show Paging” option. If we enable it then the search result is coming in the paging format. Here I have enabled it.

search result web part SharePoint 2013
search result web part SharePoint 2013

After the editing completed save the page. Now our web part page will look like below screenshort.

search results in web part SharePoint 2013
search results in web part SharePoint 2013

SharePoint search results documents filter by current user

Here we will see in the search result web part, how to display the documents which are created by the logged-in user or the current user.

Like the modified by the same thing can be followed here. In the “Query text”, I have added “CreatedBy:{User. Name}”. Clicked on “Test Query”. Click on Ok and save the page.

search results in web part SharePoint online
search results in web part SharePoint online

The below out put will come in the web part page.

search results in web part SharePoint 2013
search results in web part SharePoint 2013

Here, we learned how to use the SharePoint search results web part and how to display document filter by the current user.

  • sharepoint search results
  • sharepoint search results web part
  • Search results web part in SharePoint online
  • sharepoint online search results web part
  • configure search results web part sharepoint online

You may like following SharePoint search tutorials:

Hope this SharePoint search tutorial helps to learn the content search web part in SharePoint Online or SharePoint 2016/2013 or SharePoint 2019.

We saw what is a content search web part? How can we add and configure a content search web part in SharePoint Online/2019/2016/2013? How to configure content search web part to display images from a particular SharePoint Online document library. Also, we will see how to use SharePoint search results web part or SharePoint online search results web part.

>