# Filtered Search

> USearch for JavaScript

A search stream pulls the next-nearest matches on the caller's own thread, which is how a JavaScript predicate filters without reserving a run wide enough to survive it:

```javascript
using stream = index.on(executor).searchStream(query);
const admitted = [];
for (let pulled = stream.next(16, arena); pulled.counts[0] && admitted.length < 10; pulled = stream.next(16, arena)) {
  const { keys, count } = pulled.get(0);
  for (let position = 0; position < count; position++) {
    const key = usearch.keyAt(keys, position).slice(); // A copy outlives the next pull, a view does not
    if (isVisibleToTenant(key)) admitted.push(key);
}
}
```

The engine-side predicate and the progress handlers are not exposed, for the reason under [What This Binding Does Not Expose](https://www.unum.cloud/docs/usearch/javascript/platform-notes.md#what-this-binding-does-not-expose).

