chef / chef/chef-server

Sorting not working for search API

Open
#8 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Aspect: UX Component: opscode-erchef Status: move to jira Status: To be prioritized Triage: Feature Request
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

The "sort" parameter in the search API is not working. Also reported in CHEF-2121.

This is causing Chef Manage(opscode/chef#2279) and 'knife search' commands to display unsorted lists. Here are some "knife search" results to show the issue:

[apop@mymac chef-repo]$ knife search role "*:*" --id-only --sort asc -VV
...
DEBUG: Initiating GET to https://api.opscode.com/organizations/ap-org1/search/role?q=*%253A*&sort=asc&start=0&rows=1000
...
3 items found

windows_web
linux_base
windows_base

Same unsorted list returned with these commands:

knife search role "*:*" --id-only --sort name
knife search role "*:*" --id-only --sort name+desc
knife search role "*:*" --id-only --sort "name desc"
knife search role "*:*" --id-only --sort ascending
knife search role "*:*" --id-only --sort asc
knife search role "*:*" --sort asc
knife search role "*:*" --sort description

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the unsorted results with the documented search API and the listed knife search commands, then trace how the sort parameter is handled between the API and search backend. Compare the behavior with CHEF-2121 and confirm the expected ordering; done means supported sort forms return consistently ordered results with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
api, backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.