Please help us by completing this survey

Go to survey
Documentation

Docs / Concepts / Content Query

Content Query

One of the main features of sensenet is Content Query. sensenet Content Repository is a query based system. This means that every content or image you see on the portal is collected by a very sophisticated and fast query engine.

As a user, portal builder or administrator you get a simple but powerful content query language (CQL). You can use this language to find, filter and sort content even in a huge and constantly expanding repository.

As a developer you get an easy-to use Application Programming Interface (API) that is capable of serving any need in your custom code.

End users

If you want details on how to search for content on the portal, create simple or more sophisticated queries to collect content, see the Query syntax page.

Developers

If you are a developer and want to extend your code with collecting and presenting content, see the Query API docs.

Content Query also works from the client side - see our OData REST API article for details.

Examples

In this section you will get some overview about where and how can you utilize the power of the Content Query.

Please check out Query syntax before proceeding!

Getting articles

If you want to get the five newest articles you can do so by defining the following query.

Type:Article .REVERSESORT:ModificationDate .TOP:5

Getting last modified documents

If you want to list the 10 last modified documents of the current user you can do so with this query:

+Type:Document +ModifiedBy:@@CurrentUser@@ .SORT:Name .TOP:10

All web content in a subtree

+TypeIs:WebContent +InTree:/Root/MyDocuments

Portlet usage examples

The examples below are related to the old WebForms user interface of sensenet. We encourage you to use a more modern UI solution using our client-side packages.

You can use query text in the following places on th UI:

Search boxes

When you search for a content on the portal, you can make a simple search for one word, but using the full Query syntax you can create more sophisticated searches.

Smart folders

SmartFolder is a very powerful portal builder feature of sensenet. You can define a query to collect content from anywhere in the portal and present them as children in a SmartFolder.

Portlet property windows

In sensenet every portlet has a property window that you can use to customize the behavior of the portlet. In some cases you can provide a content query to specify the list of content you want to present or just a filter query that narrows a children list. These portlets are for example the Content collection Portlet and the Content query presenter Portlet.

Content Picker (Search mode)

If you are editing a content that has a Reference Field or you are editing the properties of a portlet you will come across the Content Picker. You can use it to search for content if you switch to Search mode and type a query text to the text box.

Is something missing? See something that needs fixing? Propose a change here.