API docs: LSIF protocol: add searchKey
Created by: slimsag
Search integration is a long term (not immediate) goal of API docs, and unlikely to be implemented any time soon.
However, while I am looking into solidifying our LSIF data format more concretely (because dealing with backwards compatibility and/or losing all data are both annoying options), it becomes clear to me that we do not have sufficient information today to do nice, global and repository-local, search integration in the future.
This is a quick attempt at ensuring we do have that data in the future, and I believe would let us implement:
- Global fuzzy search across API docs/symbols
- Repository-local fuzzy search across API docs/symbols
- File and directory-specific fuzzy search across API docs/symbols
The first two have straightforward data implementation paths. The third point would require correlating documentation to the specific files/directories it was describing, which is not trivial (documentation may not align with files/directories at all!) but could be done by following the documentationResult->resultSet->definition->document
information trail and effectively correlating documentation with files/directories through that path.
The one thing this does not address is the fact that API docs currently only indexes top-level symbols (e.g. it doesn't index vars inside functions); this might be something that we would eventually want if we used API docs as the source of data for "quickly jump to a symbol in a repository" in Sourcegraph. We could eventually support that, but as that adds much more data and scaling concerns I am keen to defer that problem.
Helps https://github.com/sourcegraph/sourcegraph/issues/21938
Signed-off-by: Stephen Gutekanst [email protected]