1. Classes

ComparisonFilter

Version:
TypeClass
ExtendsBaseFilter
Import path@sitecore-cloudsdk/search/browser

A filter with relation conditions. Used for filtering search results by comparing the entity's attribute to a certain value.

Examples:

  • Return only those search results where title is equal to "Introduction".
  • Return only those search results where the number of words is less than 1000.

Constructor

ComparisonFilter(
  attributeName: string,
  operator: ComparisonOperators,
  value: unknown
)

Parameters

NameTypeDescription
attributeNamestringThe entity's attribute to be compared with the value.Example: "title", "numOfWords"
operatorComparisonOperatorsThe operator used for comparing the attribute with the value.Accepted values:"eq" - equal to"gt" - greater than"gte" - greater than or equal to"lt" - less than"lte" - less than or equal to
valueunknownThe value to compare the entity's attribute with.Example: "Introduction", 1000

Properties

NameTypeDescription
_attributeNamestringRequired.

The entity's attribute to be compared with the value.

Example: "title", "numOfWords"

Methods

toDTO

Maps the ComparisonFilter instance to its DTO (data transfer object) format.

Signature

toDTO(): ComparisonFilterDTO

Return value

Returns the ComparisonFilter instance in a standardized DTO format.

If you have suggestions for improving this article, let us know!