Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IPublishedContentQuery

    Query methods used for accessing strongly typed content in templates.

    Namespace: Umbraco.Cms.Core
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public interface IPublishedContentQuery

    Methods

    View Source

    Content(IEnumerable<Guid>)

    Gets the published content items for the specified unique identifiers.

    Declaration
    IEnumerable<IPublishedContent> Content(IEnumerable<Guid> ids)
    Parameters
    Type Name Description
    IEnumerable<Guid> ids

    The unique identifiers of the content items to retrieve.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An enumerable collection of published content items matching the specified identifiers.

    View Source

    Content(IEnumerable<int>)

    Retrieves the published content items corresponding to the specified collection of content IDs.

    Declaration
    IEnumerable<IPublishedContent> Content(IEnumerable<int> ids)
    Parameters
    Type Name Description
    IEnumerable<int> ids

    A collection of content item IDs to look up.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An enumerable of IPublishedContent instances matching the provided IDs. Items not found are omitted.

    View Source

    Content(IEnumerable<object>)

    Retrieves the published content items corresponding to the specified IDs.

    Declaration
    IEnumerable<IPublishedContent> Content(IEnumerable<object> ids)
    Parameters
    Type Name Description
    IEnumerable<object> ids

    A collection of IDs identifying the content items to retrieve.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An enumerable collection of IPublishedContent items matching the provided IDs.

    View Source

    Content(Guid)

    Returns the published content item with the specified unique identifier.

    Declaration
    IPublishedContent? Content(Guid id)
    Parameters
    Type Name Description
    Guid id

    The unique System.Guid identifier of the content item.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent instance if found; otherwise, null.

    View Source

    Content(int)

    Retrieves the published content item corresponding to the specified identifier.

    Declaration
    IPublishedContent? Content(int id)
    Parameters
    Type Name Description
    int id

    The unique identifier of the content item to retrieve.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent instance if found; otherwise, null.

    View Source

    Content(object)

    Gets the published content item with the specified identifier.

    Declaration
    IPublishedContent? Content(object id)
    Parameters
    Type Name Description
    object id

    The identifier of the content item to retrieve.

    Returns
    Type Description
    IPublishedContent

    The published content item if found; otherwise, null.

    View Source

    Content(Udi)

    Retrieves the published content item with the specified unique document identifier (UDI).

    Declaration
    IPublishedContent? Content(Udi id)
    Parameters
    Type Name Description
    Udi id

    The unique document identifier (UDI) of the content item to retrieve.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent instance if found; otherwise, null.

    View Source

    ContentAtRoot()

    Gets the published content items at the root level of the content tree.

    Declaration
    IEnumerable<IPublishedContent> ContentAtRoot()
    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An enumerable collection of root-level Umbraco.Cms.Core.Models.IPublishedContent items.

    View Source

    Media(IEnumerable<Guid>)

    Retrieves media items corresponding to the specified unique identifiers.

    Declaration
    IEnumerable<IPublishedContent> Media(IEnumerable<Guid> ids)
    Parameters
    Type Name Description
    IEnumerable<Guid> ids

    A collection of unique identifiers for the media items to retrieve.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An enumerable collection of media items matching the provided identifiers.

    View Source

    Media(IEnumerable<int>)

    Gets the media items corresponding to the specified IDs.

    Declaration
    IEnumerable<IPublishedContent> Media(IEnumerable<int> ids)
    Parameters
    Type Name Description
    IEnumerable<int> ids

    The collection of media item IDs to retrieve.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An System.Collections.Generic.IEnumerable<T> of Umbraco.Cms.Core.Models.IPublishedContent representing the found media items.

    View Source

    Media(IEnumerable<object>)

    Retrieves media items corresponding to the specified identifiers.

    Declaration
    IEnumerable<IPublishedContent> Media(IEnumerable<object> ids)
    Parameters
    Type Name Description
    IEnumerable<object> ids

    A collection of identifiers for the media items to retrieve.

    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An System.Collections.Generic.IEnumerable<T> of Umbraco.Cms.Core.Models.IPublishedContent representing the found media items.

    View Source

    Media(Guid)

    Returns the media item with the specified unique identifier.

    Declaration
    IPublishedContent? Media(Guid id)
    Parameters
    Type Name Description
    Guid id

    The unique System.Guid identifier of the media item.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent representing the media item if found; otherwise, null.

    View Source

    Media(int)

    Gets the media item with the specified identifier.

    Declaration
    IPublishedContent? Media(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the media item.

    Returns
    Type Description
    IPublishedContent

    The media item if found; otherwise, null.

    View Source

    Media(object)

    Returns the media item corresponding to the specified identifier.

    Declaration
    IPublishedContent? Media(object id)
    Parameters
    Type Name Description
    object id

    The identifier of the media item to retrieve.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent representing the media item if found; otherwise, null.

    View Source

    Media(Udi)

    Retrieves a media item using its unique identifier (UDI).

    Declaration
    IPublishedContent? Media(Udi id)
    Parameters
    Type Name Description
    Udi id

    The unique identifier (UDI) of the media item.

    Returns
    Type Description
    IPublishedContent

    The IPublishedContent representing the media item if found; otherwise, null.

    View Source

    MediaAtRoot()

    Returns all media items that are located at the root of the media library.

    Declaration
    IEnumerable<IPublishedContent> MediaAtRoot()
    Returns
    Type Description
    IEnumerable<IPublishedContent>

    An System.Collections.Generic.IEnumerable<T> containing the root-level media items.

    View Source

    Search(IQueryExecutor)

    Executes the query and converts the results to PublishedSearchResult.

    Declaration
    IEnumerable<PublishedSearchResult> Search(IQueryExecutor query)
    Parameters
    Type Name Description
    IQueryExecutor query

    The query.

    Returns
    Type Description
    IEnumerable<PublishedSearchResult>

    The search results.

    View Source

    Search(IQueryExecutor, int, int, out long)

    Executes the query and converts the results to PublishedSearchResult.

    Declaration
    IEnumerable<PublishedSearchResult> Search(IQueryExecutor query, int skip, int take, out long totalRecords)
    Parameters
    Type Name Description
    IQueryExecutor query

    The query.

    int skip

    The amount of results to skip.

    int take

    The amount of results to take/return.

    long totalRecords

    The total amount of records.

    Returns
    Type Description
    IEnumerable<PublishedSearchResult>

    The search results.

    View Source

    Search(IQueryExecutor, int, int, out long, string?)

    Executes the query and converts the results to PublishedSearchResult.

    Declaration
    IEnumerable<PublishedSearchResult> Search(IQueryExecutor query, int skip, int take, out long totalRecords, string? culture)
    Parameters
    Type Name Description
    IQueryExecutor query

    The query.

    int skip

    The amount of results to skip.

    int take

    The amount of results to take/return.

    long totalRecords

    The total amount of records.

    string culture

    The culture (defaults to a culture insensitive search).

    Returns
    Type Description
    IEnumerable<PublishedSearchResult>

    The search results.

    Remarks

    While enumerating results, the ambient culture is changed to be the searched culture.

    View Source

    Search(string, int, int, out long, string, string, ISet<string>?)

    Searches content.

    Declaration
    IEnumerable<PublishedSearchResult> Search(string term, int skip, int take, out long totalRecords, string culture = "*", string indexName = "ExternalIndex", ISet<string>? loadedFields = null)
    Parameters
    Type Name Description
    string term

    The term to search.

    int skip

    The amount of results to skip.

    int take

    The amount of results to take/return.

    long totalRecords

    The total amount of records.

    string culture

    The culture (defaults to a culture insensitive search).

    string indexName

    The name of the index to search (defaults to ExternalIndexName).

    ISet<string> loadedFields

    This parameter is no longer used, because the results are loaded from the published snapshot using the single item ID field.

    Returns
    Type Description
    IEnumerable<PublishedSearchResult>

    The search results.

    Remarks

    When the culture is not specified or is *, all cultures are searched. To search for only invariant documents and fields use null. When searching on a specific culture, all culture specific fields are searched for the provided culture and all invariant fields for all documents.

    While enumerating results, the ambient culture is changed to be the searched culture.

    View Source

    Search(string, string, string)

    Searches content.

    Declaration
    IEnumerable<PublishedSearchResult> Search(string term, string culture = "*", string indexName = "ExternalIndex")
    Parameters
    Type Name Description
    string term

    The term to search.

    string culture

    The culture (defaults to a culture insensitive search).

    string indexName

    The name of the index to search (defaults to ExternalIndexName).

    Returns
    Type Description
    IEnumerable<PublishedSearchResult>

    The search results.

    Remarks

    When the culture is not specified or is *, all cultures are searched. To search for only invariant documents and fields use null. When searching on a specific culture, all culture specific fields are searched for the provided culture and all invariant fields for all documents.

    While enumerating results, the ambient culture is changed to be the searched culture.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX