1. Clients

Search client

The Search client in the Web SDK enables developers to perform powerful and flexible search operations on entities. It supports full-text search, filtering, sorting, pagination, and localization.

The following methods are available.

SearchAsync

Performs a search for entities using a SearchRequest object that supports a wide range of filtering, sorting, and configuration options.

The parameters you can use with the SearchAsync method are detailed in the following table.

PropertyTypeDescription
QuerystringThe search query string.
LogicalGroupingTemplatestringTemplate for logical grouping.
SearchDefaultsstringDefault search configuration.
ConfigurationCategorystringConfiguration category.
ComponentIdlongComponent ID.
CultureCultureInfoCulture info (defaults to InvariantCulture).
SortingSortingRequestResourceSorting expression.
CustomSortingIDictionary<string, int>Custom sorting.
SkipintRecords to skip (pagination).
TakeintRecords to take (pagination, default is 25).
FiltersList<FieldFilterRequestResource>Filters to apply.
FullTextFiltersList<string>Full-text filters.
FieldsList<string>Fields to include in results.
SavedSelectionlongSaved selection ID.
ViewstringView type for results.
CalendarStartDateDateTimeCalendar filter start date.
CalendarStopDateDateTimeCalendar filter stop date.
SelectionPoolSelectionPoolFilterResourceSelection pool filter.
AggregationsList<AggregationRequestResource>Aggregation requests.
NestedRelationsIEnumerable<NestedRelationInfo>Nested relations to include.
GroupSearchGroupRequestResourceGrouping request.
IsInitialRequestboolIndicates if this is the initial request.
TakeUserSettingsboolUse user settings.
L10NboolUse localization.
VisualSearchVisualSearchRequestResourceVisual search request.
ExtensionDataIDictionary<string, JToken>Additional extension data.

The following code provides a full-text search example.

var searchRequest = new SearchRequest
{
  ComponentId = 840,
  Culture = new CultureInfo("en-US"),
  Sorting = new SortingRequestResource
  {
    FieldName = "createdon",
    Ascending = false
  },
  Skip = 0,
  Take = 10,
  FullTextFilters = new List<string> { "Keyword" },
  Fields = new List<string> { "Title", "Description" }
};
var result = await MClient.Search.SearchAsync(searchRequest);

GetAllFacetValuesAsync

Retrieves all available values for a specified facet field using an AllFacetsRequest.

The parameters you can use with the GetAllFacetValuesAsync method are detailed in the following table.

PropertyTypeDescription
FacetFieldNamestringName of the facet field.
QuerystringOptional query for facet values.
SearchConfigurationNamestringName of the search configuration.
CultureCultureInfoCulture for facet values.
ComponentIdlongComponent ID.
FiltersIList<FieldFilterRequestResource>Filters to apply.
TakeUserSettingsboolUse user settings.
L10NboolUse localization.
SkipintRecords to skip (pagination).
TakeintRecords to take (pagination).

The following code provides an example of how to get facet values.

var allFacetsRequest = new AllFacetsRequest
{
  FacetFieldName = $"taxonomy_items.{tagId}.children",
  Query = "",
  SearchConfigurationName = "DefaultSearchConfig",
  Culture = new CultureInfo("en-US"),
  ComponentId = 840,
  Filters = new List<FieldFilterRequestResource>(),
  TakeUserSettings = false,
  L10N = false,
  Skip = 0,
  Take = 10
};
var result = await MClient.Search.GetAllFacetValuesAsync(allFacetsRequest);

Exceptions

  • ArgumentNullException – if the request is null.
  • ArgumentOutOfRangeException – if Take or Skip is negative.
  • ArgumentException – if any filter or culture is invalid.
If you have suggestions for improving this article, let us know!