Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created April 8, 2025 12:45
Show Gist options
  • Save sitefinitySDK/25c1dbb1ae4d8555089b5a3acfeb14d1 to your computer and use it in GitHub Desktop.
Save sitefinitySDK/25c1dbb1ae4d8555089b5a3acfeb14d1 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using Telerik.Sitefinity.Search;
using Telerik.Sitefinity.Services.Search.Data;
namespace Telerik.Sitefinity.Services.Search
{
/// <summary>
/// The contract for search operations that provide the ability to create search catalogues, index and returns the documents matching search query.
/// </summary>
public interface ISearchService
{
/// <summary>
/// Searches using given query and returns the documents matching the query.
/// </summary>
/// <param name="query">The search query.</param>
/// <returns>The result set</returns>
IResultSet Search(ISearchQuery query);
/// <summary>
/// Searches using given query and returns the documents matching the query.
/// </summary>
/// <param name="query">The search query.</param>
/// <param name="searchOptions">The search options.</param>
/// <returns>The result set</returns>
IResultSet Search(ISearchQuery query, SearchOptions searchOptions);
/// <summary>
/// Creates new search index
/// </summary>
/// <param name="name">The name of the index</param>
/// <param name="fieldDefinitions">The definitions for the fields included in the search index</param>
void CreateIndex(string name, IEnumerable<IFieldDefinition> fieldDefinitions);
/// <summary>
/// Adds or updates the provided documents in the specified index.
/// </summary>
/// <param name="name">Name of the index.</param>
/// <param name="documents">A collection of documents to add or update.</param>
void UpdateIndex(string name, IEnumerable<IDocument> documents);
/// <summary>
/// Return true if the index exists.
/// </summary>
/// <param name="indexName">Name of the index.</param>
/// <returns>A value, indicating if the index exists</returns>
bool IndexExists(string indexName);
/// <summary>
/// Removes the provided documents from the specified catalogue.
/// </summary>
/// <param name="indexName">The name of the index.</param>
/// <param name="documents">The collection of documents to remove.</param>
void RemoveDocuments(string indexName, IEnumerable<IDocument> documents);
/// <summary>
/// Removes the document with the specified identity from the specified catalogue.
/// </summary>
/// <param name="indexName">The name of the index.</param>
/// <param name="identityField">The identity field.</param>
void RemoveDocument(string indexName, IField identityField);
/// <summary>
/// Renames the specified index.
/// </summary>
/// <param name="indexName">The name of the index.</param>
/// <param name="newIndexName">The new name of the index.</param>
void RenameIndex(string indexName, string newIndexName);
/// <summary>
/// Deletes the specified index.
/// </summary>
/// <param name="indexName">The name of the index.</param>
void DeleteIndex(string indexName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment