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

Global Search shows IP Addresses in created order, not ascending order. #13940

Closed
jjenjysk opened this issue Oct 2, 2023 · 4 comments
Closed

Comments

@jjenjysk
Copy link

jjenjysk commented Oct 2, 2023

NetBox version

v3.6.3

Python version

3.11

Steps to Reproduce

  1. Create IP Address objects in the following order: 10.0.0.20/24, 10.0.0.21/24, 10.0.0.1/24
  2. Search for 10.0.0 with global search

Expected Behavior

All IPs matching show up in ascending order (similar to IP Addresses tab).

Observed Behavior

All IPs were shown in created order.

image

@jjenjysk jjenjysk added the type: bug A confirmed report of unexpected behavior in the application label Oct 2, 2023
@PieterL75
Copy link
Contributor

This is actually the case for all kind of models. I observed the same for the device, sites, ....

@jeremystretch
Copy link
Member

All IPs matching show up in ascending order (similar to IP Addresses tab).

While I certainly understand your expectation, IMO it's a bit of a gray area to treat this a bug. Search results are intentionally ordered first by precedence (weight), then by object type, and finally by object ID:

class CachedValue:
    class Meta:
        ordering = ('weight', 'object_type', 'object_id')

This is because 1) the ordering of values among matching results does not imply stronger or weaker relevance to the query, and 2) it's likely there are cases where sorting by raw value may result in unexpected ordering (though I can't think of any at the moment). I'd be open to treating this as a feature request if we give the later point a bit more consideration.

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Oct 5, 2023
@jjenjysk
Copy link
Author

Personally I'd expect at least IP addresses/ranges to show up in ascending order instead of the order they were created in. I understand that it is a gray area to consider it a bug after your explanation, but I would like this as a feature.

@jeremystretch
Copy link
Member

I've opened FR #14035 to track this proposal.

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2023
@jeremystretch jeremystretch removed type: bug A confirmed report of unexpected behavior in the application status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Oct 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants