Skip to content

Automatically redirect from the search page if an exact match is found #1544

@Codefoxdev

Description

@Codefoxdev

For quickly looking up packages on npmx, I have configured a custom search engine in my browser that uses the npmx search page. However, currently the result of the search will always show the search page, when it would be nice to automatically redirect to the package page when an exact match is found.

One possible way to do so, would be to add another search parameter to the query, that when found it will automatically redirect to the package page, which would not disturb normal search behaviour in any way.

This approach does have one problem: a lot of the times the behaviour of not automatically redirecting is desired, or there is a package that coincidentally has the same name as your search query, which would be frustrating.

So, my proposed solution is to allow the user to add character (I would suggest an !, since it would be the most explicit and is not allowed in a package name anyway) to the search query, which would trigger the search page to automatically redirect to the package, if an exact match is found and ignore the character if not.

This behaviour would be simple to implement, not disturb the existing search page in any way, and add a quicker way to search for packages, either via configuring a search engine or using something like DuckDuckGo's bangs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions