Skip to content

Search backend: remove Dnf and friends

Warren Gifford requested to merge cc/remove-dnf into main

Created by: camdencheek

We replaced the functionality of Dnf with BuildPlan, which maintains tree structure of pattern nodes. I hadn't yet removed the now-unnecessary Dnf code because I wanted it to be easy to revert, but it's been out there for a bit with no issues. This replaces uses of Dnf with BuildPlan, and removes it and associated code. I think there is more code to simplify here, but I'll leave that for a followup PR.

Followup from https://github.com/sourcegraph/sourcegraph/pull/34382#discussion_r857828205

Some background: We previously ran DNF over all queries, which converted queries like repo:a (b or c) into or-separated terms like (repo:a b) or (repo:a c). This is useful for sending queries to backends that do not support and/or operators because we can send them simpler queries and join the results in frontend. However, both zoekt and gitserver commit/diff search do support those operators natively. In order to send zoekt and gitserver optimized queries, we needed to stop splitting up those pattern nodes ahead of time so that we can generate native zoekt and commit search queries that have these and/or patterns in them.

Test plan

Relying on tests. This shouldn't change any behavior visible to a user, but may change some conversions of queries to plans. Running backend integration tests on the branch.

Merge request reports

Loading