Files
Umbraco-CMS/src/Umbraco.Infrastructure/IPublishedContentQuery.cs
Elitsa Marinovska 9c18cd22e0 V14: Deleted code marked as obsolete for V14 (#15998)
* Obsoletions related to Delivery API

* Fix TypeLoader and TypeFinder tests

* Remove obsolete and default implementations of IFileSource and IFileTypeCollection

* More Delivery API related obsoletions

* VariationContextAccessor related

* ValueFactories obsoletion and fix references

* ValueSetBuilders obsoletions

* ValueConverters obsoletions

* Other obsolete ctors and methods

* Forgotten VariationContextAccessor obsoletion

* More obsoletions

* XPath related obsoletions

* Revert XmlHelper changes

* Delete RenamedRootNavigator and its tests

* Fix test

* XmlHelper obsoletion

* Return null instead of GetXPathValue

* Obsolete entire class instead

* Remove XPath obsoletions from IPublishedCache

* Remove XPath-related if-block that is no longer needed

* Change obsolete msg for classes needed for NuCache

* Moving classes to NuCache and making them internal

* Remove more XPath-related obsoletions

* Remove NavigableNavigator and its tests

* Cleanup

* Remove Xpath references from tests

* Revert interface deletion in MediaCache

* Using XOR operation

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>

---------

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>
2024-04-09 09:06:48 +02:00

141 lines
5.6 KiB
C#

using Examine.Search;
using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core;
/// <summary>
/// Query methods used for accessing strongly typed content in templates.
/// </summary>
public interface IPublishedContentQuery
{
IPublishedContent? Content(int id);
IPublishedContent? Content(Guid id);
IPublishedContent? Content(Udi id);
IPublishedContent? Content(object id);
IEnumerable<IPublishedContent> Content(IEnumerable<int> ids);
IEnumerable<IPublishedContent> Content(IEnumerable<Guid> ids);
IEnumerable<IPublishedContent> Content(IEnumerable<object> ids);
IEnumerable<IPublishedContent> ContentAtRoot();
IPublishedContent? Media(int id);
IPublishedContent? Media(Guid id);
IPublishedContent? Media(Udi id);
IPublishedContent? Media(object id);
IEnumerable<IPublishedContent> Media(IEnumerable<int> ids);
IEnumerable<IPublishedContent> Media(IEnumerable<object> ids);
IEnumerable<IPublishedContent> Media(IEnumerable<Guid> ids);
IEnumerable<IPublishedContent> MediaAtRoot();
/// <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>
/// <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>
/// <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>
IEnumerable<PublishedSearchResult> Search(
string term,
int skip,
int take,
out long totalRecords,
string culture = "*",
string indexName = Constants.UmbracoIndexes.ExternalIndexName,
ISet<string>? loadedFields = null);
/// <summary>
/// Searches content.
/// </summary>
/// <param name="term">The term to search.</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="Cms.Core.Constants.UmbracoIndexes.ExternalIndexName" />).
/// </param>
/// <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>
IEnumerable<PublishedSearchResult> Search(string term, string culture = "*", string indexName = Constants.UmbracoIndexes.ExternalIndexName);
/// <summary>
/// Executes the query and converts the results to <see cref="PublishedSearchResult" />.
/// </summary>
/// <param name="query">The query.</param>
/// <returns>
/// The search results.
/// </returns>
IEnumerable<PublishedSearchResult> Search(IQueryExecutor query);
/// <summary>
/// Executes the query and converts the results to <see cref="PublishedSearchResult" />.
/// </summary>
/// <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>
IEnumerable<PublishedSearchResult> Search(IQueryExecutor query, int skip, int take, out long totalRecords);
/// <summary>
/// Executes the query and converts the results to <see cref="PublishedSearchResult" />.
/// </summary>
/// <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>
/// <param name="culture">The culture (defaults to a culture insensitive search).</param>
/// <returns>
/// The search results.
/// </returns>
/// <remarks>
/// While enumerating results, the ambient culture is changed to be the searched culture.
/// </remarks>
IEnumerable<PublishedSearchResult> Search(IQueryExecutor query, int skip, int take, out long totalRecords, string? culture)
=> Search(query, skip, take, out totalRecords);
}