Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: is it possible to add a query filter on "topics:" #783

Open
hanskr opened this issue May 24, 2024 · 5 comments
Open

Feature request: is it possible to add a query filter on "topics:" #783

hanskr opened this issue May 24, 2024 · 5 comments

Comments

@hanskr
Copy link

hanskr commented May 24, 2024

No description provided.

@keegancsmith
Copy link
Member

This is quite github specific feature request. However, maybe a more generic "repository labels" would make sense here. For example we already have this sort of idea for supporting filtering by archived/fork/etc but that is a static list. Then we could expose in the query parser topic:.

FYI I don't think this would get worked on anytime soon, but happy to guide anyone who is motivated to do it.

@hanskr
Copy link
Author

hanskr commented May 27, 2024

A generic labels/tags/topics functionality that could be populated by "something" per type of backend (topics for GH) (not sure if others have similar functionality) sound like a good approach, and would solve my needs fine.

For now, I have worked my way around it with a script that uses the GH api to translate topics => repo-names and construct a zoekt query with a repo regex.

@xavier-calland
Copy link
Contributor

A generic labels/tags/topics feature would be great.

@xavier-calland
Copy link
Contributor

@keegancsmith I can try to look at this feature, but I need details on the different modifications to be made.
Can you guide me?

@stefanhengl
Copy link
Member

stefanhengl commented Sep 10, 2024

@xavier-calland

Here is how I would get started

  1. The labels would probably have to live here. Why? For Sourcegraph we have an optimization that updates to metadata don't cause a reindex (see .meta files in the code). I think repository labels shouldn't cause a full reindex.
  2. Indexing: Pick a code host (probably GitHub) and pipe the data from the code host all the way to the builder, which writes the metadata to disk.
  3. Query language: you have to extend the query language. You could add EG a label: filter. Check out query.go and parse.go for inspiration.
  4. Matchtree: The final piece is to use a match tree to skip the repos that don't have the correct label. Checkout RepoSet in matchtree.go or any of the other match trees there for inspiration.

EDIT:
5. UI: It would be nice to show the labels in UI, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants