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

Composable search language #809

Open
tchoutri opened this issue Dec 27, 2024 — with Linear · 0 comments
Open

Composable search language #809

tchoutri opened this issue Dec 27, 2024 — with Linear · 0 comments
Labels
component:search enhancement New feature or request help wanted Help is needed for this ticket

Comments

Copy link
Contributor

tchoutri commented Dec 27, 2024

There are a number of search qualifiers, and it's not yet possible to compose them. Some of them cannot be composed, so we must have some kind of algebra that determines how qualifiers can be composed. Maybe look at how Github does it?

There are a number of questions to answer:

  • Which modifiers are mutually-exclusive / cannot be composed?
    • How do we model a query so that one modifier takes precedence regarding the source? To search for advisories within the dependents of a packages, depends: and hsec: could in theory be both used.
  • Right now, the search results are taken from PostgreSQL. Is this the appropriate storage engine?

Package qualifiers

  • depends:<@namespace>/<packagename>: Shows the dependents page for a package
  • in:<@namespace> <search term>: Searches for a package name in the specified namespace
    • in:<@namespace>: Lists packages in a namespace
  • exe:<search term> look for packages that expose an executable with a high proximity to the search term

Advisories

  • hsec:<search term> look for advisories whose summary contain a high proximity to the search term

Search Language AST:

data SearchQuery
  = PackageName SearchOperator Text SearchQuery
  | PackageNamespace MembershipOperator Text SearchQuery
  | Nil
  deriving stock (Eq, Ord, Show)

data EqualityOperator 
  = NotEquals
  | Equals
  deriving stock (Eq, Ord, Show)

data MembershipOperator
  = In
  | NotIn
  deriving stock (Eq, Ord, Show)

-- Only for executables right now
data OwnershipOperator 
  = Has Object 
  | HasNot Object
  deriving stock (Eq, Ord, Show)

data Object
  = Executable Name
  deriving stock (Eq, Ord, Show)

Then a transformation from SearchQuery to SQL fragments will happen.

@tchoutri tchoutri added component:search enhancement New feature or request help wanted Help is needed for this ticket labels Dec 27, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:search enhancement New feature or request help wanted Help is needed for this ticket
Projects
None yet
Development

No branches or pull requests

1 participant