2022-02-15 16:46:20 +01:00
using System ;
2016-06-30 18:35:43 +02:00
using System.Collections.Generic ;
using System.Xml.XPath ;
2018-12-17 12:17:03 +11:00
using Examine.Search ;
2021-02-09 10:22:42 +01:00
using Umbraco.Cms.Core.Models.PublishedContent ;
using Umbraco.Cms.Core.Xml ;
2016-06-30 18:35:43 +02:00
2021-02-15 13:14:07 +01:00
namespace Umbraco.Cms.Core
2016-06-30 18:35:43 +02:00
{
/// <summary>
2022-02-15 16:46:20 +01:00
/// Query methods used for accessing strongly typed content in templates.
2016-06-30 18:35:43 +02:00
/// </summary>
public interface IPublishedContentQuery
{
2022-02-22 13:35:32 +01:00
IPublishedContent ? Content ( int id ) ;
2022-02-15 16:46:20 +01:00
2016-11-03 10:31:44 +01:00
IPublishedContent Content ( Guid id ) ;
2022-02-15 16:46:20 +01:00
2022-02-22 13:35:32 +01:00
IPublishedContent ? Content ( Udi id ) ;
2022-02-15 16:46:20 +01:00
2022-02-22 13:35:32 +01:00
IPublishedContent ? Content ( object id ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IPublishedContent ContentSingleAtXPath ( string xpath , params XPathVariable [ ] vars ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > Content ( IEnumerable < int > ids ) ;
2022-02-15 16:46:20 +01:00
2016-11-03 10:31:44 +01:00
IEnumerable < IPublishedContent > Content ( IEnumerable < Guid > ids ) ;
2020-03-03 11:59:17 +01:00
IEnumerable < IPublishedContent > Content ( IEnumerable < object > ids ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > ContentAtXPath ( string xpath , params XPathVariable [ ] vars ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > ContentAtXPath ( XPathExpression xpath , params XPathVariable [ ] vars ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > ContentAtRoot ( ) ;
2022-02-22 13:35:32 +01:00
IPublishedContent ? Media ( int id ) ;
2022-02-15 16:46:20 +01:00
2016-11-05 12:22:57 +01:00
IPublishedContent Media ( Guid id ) ;
2022-02-15 16:46:20 +01:00
2022-02-22 13:35:32 +01:00
IPublishedContent ? Media ( Udi id ) ;
2020-03-03 11:59:17 +01:00
2022-02-22 13:35:32 +01:00
IPublishedContent ? Media ( object id ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > Media ( IEnumerable < int > ids ) ;
2022-02-15 16:46:20 +01:00
2020-03-03 11:59:17 +01:00
IEnumerable < IPublishedContent > Media ( IEnumerable < object > ids ) ;
2022-02-15 16:46:20 +01:00
2016-11-05 12:22:57 +01:00
IEnumerable < IPublishedContent > Media ( IEnumerable < Guid > ids ) ;
2022-02-15 16:46:20 +01:00
2016-06-30 18:35:43 +02:00
IEnumerable < IPublishedContent > MediaAtRoot ( ) ;
2021-02-16 20:56:44 +13:00
/// <summary>
/// Searches content.
/// </summary>
/// <param name="term">The term to search.</param>
/// <param name="skip">The amount of results to skip.</param>
/// <param name="take">The amount of results to take/return.</param>
/// <param name="totalRecords">The total amount of records.</param>
/// <param name="culture">The culture (defaults to a culture insensitive search).</param>
/// <param name="indexName">The name of the index to search (defaults to <see cref="Constants.UmbracoIndexes.ExternalIndexName" />).</param>
2022-02-15 16:46:20 +01:00
/// <param name="loadedFields">This parameter is no longer used, because the results are loaded from the published snapshot using the single item ID field.</param>
2021-02-16 20:56:44 +13:00
/// <returns>
/// The search results.
/// </returns>
/// <remarks>
/// <para>
/// When the <paramref name="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.
/// </para>
/// <para>While enumerating results, the ambient culture is changed to be the searched culture.</para>
/// </remarks>
2022-02-18 14:32:51 +01:00
IEnumerable < PublishedSearchResult > Search ( string term , int skip , int take , out long totalRecords , string culture = "*" , string indexName = Constants . UmbracoIndexes . ExternalIndexName , ISet < string > ? loadedFields = null ) ;
2016-06-30 18:35:43 +02:00
/// <summary>
2018-03-27 10:04:07 +02:00
/// Searches content.
2016-06-30 18:35:43 +02:00
/// </summary>
2019-11-13 14:39:52 +01:00
/// <param name="term">The term to search.</param>
/// <param name="culture">The culture (defaults to a culture insensitive search).</param>
2021-02-09 10:22:42 +01:00
/// <param name="indexName">The name of the index to search (defaults to <see cref="Cms.Core.Constants.UmbracoIndexes.ExternalIndexName" />).</param>
2019-11-13 14:39:52 +01:00
/// <returns>
/// The search results.
/// </returns>
2018-12-20 13:29:57 +01:00
/// <remarks>
2019-07-24 18:46:14 +10:00
/// <para>
2019-11-13 14:39:52 +01:00
/// When the <paramref name="culture" /> is not specified or is *, all cultures are searched.
2019-07-24 18:46:14 +10:00
/// 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.
/// </para>
2019-01-11 08:26:53 +01:00
/// <para>While enumerating results, the ambient culture is changed to be the searched culture.</para>
2018-12-20 13:29:57 +01:00
/// </remarks>
2020-01-05 22:26:13 +01:00
IEnumerable < PublishedSearchResult > Search ( string term , string culture = "*" , string indexName = Constants . UmbracoIndexes . ExternalIndexName ) ;
2018-03-27 10:04:07 +02:00
/// <summary>
2019-11-14 09:23:18 +01:00
/// Executes the query and converts the results to <see cref="PublishedSearchResult" />.
2016-06-30 18:35:43 +02:00
/// </summary>
2019-11-13 14:39:52 +01:00
/// <param name="query">The query.</param>
/// <returns>
/// The search results.
/// </returns>
2018-12-17 12:17:03 +11:00
IEnumerable < PublishedSearchResult > Search ( IQueryExecutor query ) ;
2018-03-27 10:04:07 +02:00
/// <summary>
2019-11-14 09:23:18 +01:00
/// Executes the query and converts the results to <see cref="PublishedSearchResult" />.
2018-03-27 10:04:07 +02:00
/// </summary>
2019-11-13 14:39:52 +01:00
/// <param name="query">The query.</param>
/// <param name="skip">The amount of results to skip.</param>
/// <param name="take">The amount of results to take/return.</param>
/// <param name="totalRecords">The total amount of records.</param>
/// <returns>
/// The search results.
/// </returns>
2018-12-17 12:17:03 +11:00
IEnumerable < PublishedSearchResult > Search ( IQueryExecutor query , int skip , int take , out long totalRecords ) ;
2016-06-30 18:35:43 +02:00
}
2017-07-20 11:21:28 +02:00
}