Showing posts with label CSWP. Show all posts
Showing posts with label CSWP. Show all posts

Wednesday, 12 November 2014

SharePoint Content Search Web Part (CSWP)


Content Search Web Part (CSWP):  This is new web part in SharePoint 2013 and SPO. It will take a query and get the results based on query.
We can create a result source (Result source: where we can write query) and select that in CSWP.

We can apply custom Item and Control template to render the data.

Normally all search output pages will expect some input, but in CSWP we can get the result with out input. Mean if you want to show List Items in a page, we can use CSWP with query as select My list items.
So CSWP will get all list items, with out writing any code..we can all filtering for query.

We can use custom display templates (Item/ control template) to show custom rendering.

How to add a Content Search Web Part to a page:

Go to SharePoint site, open any page. Click Edit page.
In the Web Part Zone where you want to add the Web Part, click Add a Web Part.
In the Categories list, click Content Rollup.
In the Parts list, click Content Search, and then click Add.
The CSWP contains a default query, so it already displays some content.
Note: To get our content, we'll need to configure the query in the Web Part.

How to configure a query in a Content Search Web Part on a category page

In the Web Part, click the Web Part Menu , and then click Edit Web Part.
In the Web Part tool pane, click Change query. This will open a dialog box.
Now you can play and try with different query to get your data.

If you want to change the display templates.
Under "Display Templates"
Change "Control" and "Item" dropdowns..You will see some out of box templates...
You can add custom templates also..

Monday, 10 March 2014

SharePoint Content Search Web Part (CSWP) or the Content Query Web Part (CQWP)

The CSWP can return any content from the search index. Use it on your SharePoint 2013 sites when you are connecting to a search service and want to return indexed search results in your pages.
The CSWP returns content that is as fresh as the latest crawl of your content, so if you crawl often, the content that the CSWP returns is more up-to-date than if you crawl infrequently. If you need to display instant content or the refreshed version of content, use the Content Query Web Part (CQWP) instead.
Search crawls only the major versions of content, never the minor versions. If you want to display the minor versions of your content, do that by using a CQWP.
Some site collection administrators mark sites to not be indexed. Content marked in this way is not available in a CSWP. If you want to return results from a site that is marked to not index, use the CQWP instead.