> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# searchRelative

```typescript
searchRelative(candidates: AccessibilityNode[], landmarks: AccessibilityNode[], relation: (candidate: BoundingBox, landmark: BoundingBox) => boolean): AccessibilityNode[]
```

Keep `candidates` whose box sits in `relation` to at least one
landmark. Find them however you want (`scoredSearch`, a VLM +
\[`Machine.nodeAtPoint`], `find`, …). Candidates with no box are
omitted from the result. Input order is preserved.

Binding for `simulang_rs::search_relative`. `relation` is
`(candidate, landmark) => boolean` — compose the
\[`BoundingBox`] predicates however you want:

```js
const buttons = window.scoredSearch(/* … */, "I'm Feeling Lucky", 0.75)
const fields = window.scoredSearch(/* … */, "Google Search", 0.75)
searchRelative(buttons, fields, (button, field) =>
  button.isBelow(field) && button.overlapsX(field)
)
```

## Parameters

<ResponseField name={"candidates"} type={"AccessibilityNode[]"} required />

<ResponseField name={"landmarks"} type={"AccessibilityNode[]"} required />

<ResponseField name={"relation"} type={"(candidate: BoundingBox, landmark: BoundingBox) => boolean"} required />

## Returns

`AccessibilityNode[]`
