serpent-os / tools

The home of moss (system state manager) and boulder (moss format build tool)
https://serpentos.com
137 stars 12 forks source link

Implement `moss search (sr)` #34

Open ikeycode opened 1 year ago

ikeycode commented 1 year ago

The search feature is going to be implemented in steps.

First step

The first step will accept one keyword, that'll be searched inside package names and summaries, case-insensitively.

Second step

We'll want to pass moss multiple keywords to narrow the search results and make them more relevant. As an example, searching for email cli may return packages that are both email clients, and terminal-based (without a GUI). While we take the time to complete the second step, a workaround for a similar outcome is to search with one keyword and then to grep the result list.

Implementation

We use a SQLite3 backend to store package metadata. For performance reasons and to make the code likely clearer, we are going to use SQLite3's full-text search. \ We also use Diesel as the ORM inside moss. Diesel provides a full-text search crate that unfortunately works only with Postgres. Hopefully, we'll be able to upstream a similar SQLite3-based implementation and use it inside moss.

livingsilver94 commented 8 months ago
ermo commented 8 months ago
  • Do we want to look for keywords in names, summaries, descriptions, and only those?

Yes, I believe that we do.

Compared to eopkg, it would be nice if the search automagically listed the part of the field(s) that match the search?

  • Is the search case insensitive? Or do we want an option for that?

Realistically, it's smart to make it case insensitive by default, then have an option to care about case sensitivity, effectively narrowing down the search interactively?

  • Do we want to rely on the sqlite db for the search?

Probably? I mean, SQL is kind of designed for this kind of thing...

livingsilver94 commented 7 months ago

I edited the top level comment with the plan we agreed upon on the Matrix chat.