# git_graph: Add remote support for search operations \(\#55167\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/149cd4e2bc2b0fc20eb65c688fe825454beeb949)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 149cd4e2bc2b0fc20eb65c688fe825454beeb949

Requested commit: 149cd4e2bc2b0fc20eb65c688fe825454beeb949

Commit: 149cd4e2bc2b0fc20eb65c688fe825454beeb949

Tree: 644c8f66906d66afb94901f072873b167be8c6a2

Author: Anthony Eid

Committer: GitHub

## Message

````
git_graph: Add remote support for search operations (#55167)

### Motivation 

This is the second of three PRs to add remote/collab support for the git
graph and is a follow-up to #54468. I'm adding remote support for the
search because it's not user accessible without the initial graph fetch
having remote support, so it allows us to merge this without having to
add full remote support. Collab guest support will be added in a
follow-up PR.

#### Summary

For large repos, searching can take a while to fully stream in all
matched results. For example, running a basic search on the Linux repo
took over 10s for me. Because of that, we want to stream search results
in chunks to downstream users to keep the time-to-first-match low. After
this change, the first chunk gets sent back after ~50ms on the Linux
repo from receiving the request.

In order to accomplish that, I added a new proto client API that allows
for a request to map to n responses. e.g.

```/dev/null/example.rs#L1-1
client.add_entity_stream_request_handler(Self::handle_search_commits);
```

Note: The proto API isn't supported over collab yet, that will be
another PR

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
````

## Parents

- [8aedcbf410d3c9d1a5ca756a05d12fdb68a192e7](https://git.cafe/gitcafe/zed/commit/8aedcbf410d3c9d1a5ca756a05d12fdb68a192e7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/149cd4e2bc2b0fc20eb65c688fe825454beeb949?format=markdown)
