google / zoekt

Fast trigram based code search

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature: "owner:" support

keegancsmith opened this issue · comments

I'm experimenting with adding owner: type queries. I'm not exactly sure on the value of this yet, but it seems like a convenient way to limit file paths. The owner data would come from OWNERS files and CODEOWNERS files. Would there be any interest for zoekt to incorporate these sort of changes? Does it even make sense to be part of the index? For CODEOWNERS we can generate the file filters at query time efficiently. Maybe for OWNERS its a bit more tricky, but still very doable at query time.

I also think in general labelling paths is a powerful concept, especially if they can be queried with a text search. Examples would be labels like the go package for a file/directory, extracted go tags, gitattributes and other data extracted from source control (eg authors). Any interest in zoekt having a more generic "labels" in its index / or a way to extend zoekts query engine to take extra label information into account?

you could interpret CODEOWNERS at query time, but you still have to add support for indexing, since you'd have to make the CODEOWNERS file available in every shard. Probably easier to insert CODEOWNERS into the metadata. Is it a useful feature, though? If the owner mechanism can include groups as owners it will be somewhat useless.

I think OWNERS will be tricky because it applies to the tree recursively, so you'd have to add this data to each file separately.

I'm open to further refinements for metadata if they are either general (ie. agnostic of language and hosting provider) or can be implemented as a generic extension (like the language: operator which the query/index system treats like an arbitrary string.)