sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.12k stars 1.29k forks source link

Ranking: reward multiple matches on a line #62799

Open jtibshirani opened 6 months ago

jtibshirani commented 6 months ago

When scoring a line, we just take the maximum score over all query terms. However, a line that contains multiple query terms often represents a better match. If the query terms appear in order, this would be an even stronger match.

Examples:

Note: currently users often work around this poor ranking by using patterntype:regexp or by wrapping queries in quotes "..."

/cc @sourcegraph/search-platform

keegancsmith commented 6 months ago

Here is some previous attempts I did related to this topic https://github.com/sourcegraph/zoekt/pull/726 and https://github.com/sourcegraph/zoekt/pull/717