---
title: "compare(byRank:)"
framework: corespotlight
role: symbol
role_heading: Instance Method
path: "corespotlight/cssearchableitem/compare(byrank:)"
---

# compare(byRank:)

Compares two items by rank and returns the result.

## Declaration

```swift
func compare(byRank other: CSSearchableItem) -> ComparisonResult
```

## Parameters

- `other`: The other item to compare against the current one.

## Return Value

Return Value A comparison result that indicates the ranked order of the items.

## Discussion

Discussion Call this function when you want to compare the current item with the one you specify. The method compares the ranks of the items.
