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: Filter - Maintained / Unmaintained #812

Open
Malix-Labs opened this issue Jul 11, 2024 · 5 comments
Open

FEATURE REQUEST: Filter - Maintained / Unmaintained #812

Malix-Labs opened this issue Jul 11, 2024 · 5 comments

Comments

@Malix-Labs
Copy link

Feature Request

A filter for maintained / unmaintained elements

@pinpox
Copy link
Member

pinpox commented Jul 24, 2024

I stumbled across this query by @garbas and @infinisil to search for unmaintained packages NixOS/rfcs#81 (comment)

However it seems to not work on the current search API. Does anyone know how to update it to the current version? I'm trying to compile a list of unmaintained packages.

I tried searching using:

{
   "from":0,
   "size":50,
   "sort":[
      {
         "_score":"desc",
         "package_attr_name":"desc",
         "package_pversion":"desc"
      }
   ],
   "query":{
      "bool":{
         "filter":[
            {
               "term":{
                  "type":{
                     "value":"package",
                     "_name":"filter_packages"
                  }
               }
            }
         ],
         "must":[
            {
               "term":{
                  "package_maintainers_set":{
                     "value":"No maintainers"
                  }
               }
            }
         ]
      }
   }
}

And:

 curl 'https://search.nixos.org/backend/latest-42-nixos-24.05/_search' \
  -H 'Authorization: Basic YVdWU0FMWHBadjpYOGdQSG56TDUyd0ZFZWt1eHNmUTljU2g=' \
  -H 'Content-Type: application/json' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  --data @query.json | jq

But that returns 0 hits. Maybe someone with more knowledge of the search syntax can spot the error in the query?

@infinisil
Copy link
Member

Oh damn, I don't even remember writing this anymore, sorry I can't help much 😅

@loprima-l
Copy link

@pinpox It appears that the package_maintainers_set value must be an empty list now ([])

@loprima-l
Copy link

This query worked for me : { "from": 0, "size": 100, "query": { "bool": { "must_not": { "exists": { "field": "package_maintainers_set" } } } } }

@pinpox
Copy link
Member

pinpox commented Nov 18, 2024

@loprima-l EDIT: got it working with your query and this command to get only the package names:

 curl 'https://search.nixos.org/backend/latest-42-nixos-24.05/_search' \
  -H 'Authorization: Basic YVdWU0FMWHBadjpYOGdQSG56TDUyd0ZFZWt1eHNmUTljU2g=' \
  -H 'Content-Type: application/json' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  --data @query.json | jq '.hits.hits[]._source.package_pname'

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