This page provides information about the most common and recommended parametrization methods available for the DocumentQuery API. The methods allow you to parameterize queries, for example to limit which pages are retrieved or specify which page columns are loaded to improve performance.
Retrieves pages based on the context of a specific user (the pages are filtered according to the user's permissions). By default, the current user's context is used. CMSActionContext may be used to provide a different user's context.
Filters the retrieved pages to excludes a website section. See the Path parametrization method for general filtering based on included or excluded website sections (page paths).
Allows filtering of the retrieved data to remove any duplicates caused by linked pages.
Selects pages assigned to specific categories. To limit the filtering only to pages in enabled categories, use the InEnabledCategories method.
Retrieves pages that are connected to another page through a named relationship.
Specifies the relative content tree depth from which pages are retrieved (starting from the root of the retrieved content tree section).
Specifies the site from which the pages are retrieved.
Allows ordering of the results based on the value of a specified column.
Allows implementation of pagination – separating the retrieved data into "pages" of a certain size. Retrieves only the data items that belong within a specific page.
Specifies the website section from which the pages are retrieved.
Specifies the number of records, which are retrieved from the database.
Allows filtering of the pages based on their properties.
There are many Where* conditions available. Experiment to find the one that suits your needs.
Retrieves pages based on the assigned tags.
Note that multiple tags assigned to different tag groups can have identical names. To search for a tag across all tag groups, omit the second method parameter.
When working with pages under workflow, you may want to retrieve the page version published on the live site in some cases and the latest edited version in others.
Retrieves the latest edited versions of pages. This parametrization method does not limit the set of retrieved pages, instead, it specifies what version of data is retrieved for pages.
Retrieves the published versions of pages. This parametrization method does not limit the set of retrieved pages, instead, it specifies what version of page data is retrieved for pages.
Retrieves pages that are in the published state on the live site (currently set to be published on the live site according to the value of their Published from/Published to settings and have a published version). This parametrization method limits the set of retrieved pages but does not ensure that the published version of page data is retrieved.
To retrieve the latest published version of pages as related to workflow and versioning, use the PublishedVersion parametrization method.
Specifies the columns of the page which are retrieved.
Performance best practice
Use the Columns method to restrict the amount of data loaded from the database and speed up the querying process.
When retrieving pages with the Columns query method, the system automatically adds several system columns to the list of retrieved columns. The extra columns are not added to queries where it is not desirable, for example, in queries including DISTINCT or GROUP BY clauses. You can disable the automatic addition of the extra system columns by setting the Properties.EnsureExtraColumns method to false.
Updating pages under workflow
When working with pages under workflow or versioning, use the Columns method only when performing read-only operations. Do not use this method with pages you want to update. The update would likely cause a data loss.
Allows you to access coupled data (i.e., fields of individual page types). This parametrization only needs to be used with MultiDocumentQuery, as DocumentQuery loads coupled data by default.
Determines whether the default culture version is retrieved for pages that are not available in the selected culture (when used together with the Culture parametrization method).
Intended for use together with the Culture method and multiple culture values. If a page is not available in the first specified culture, the query then attempts to load the next culture in the list. Retrieves the default culture version for pages that are not available for any of the specified cultures.
Specifies the culture of pages to be retrieved on multilingual websites.