Last updated
Was this helpful?
Last updated
Was this helpful?
The IPublishedContentQuery
interface contains different query methods for accessing strongly typed content in services etc.
In order to inject the IPublishedContentQuery
into your services, you must add a using statement for Umbraco.Cms.Core
and inject the service using the constructor.
Now you can access the IPublishedContentQuery
through _publishedContentQuery
By default, IPublishedContentQuery
will search on Umbraco's 'External' search index for any published content matching the provided search term.
Specifying the number of records 'to skip' and the number of records 'to take' improves performance with many matching search results. This approach is beneficial when there is a requirement to implement paging.
For more complex searching you can construct an Examine QueryExecutor. In the example the search will execute against content of type "blogPost" only.
Querying in views with IPublishedContentQuery in Umbraco