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

Freshports should suggest alternatives when accessing nonexistant port #614

Open
clausecker opened this issue Jan 6, 2025 · 4 comments
Open
Assignees

Comments

@clausecker
Copy link

When I go to a port by typing https://freshports.org/$category/$port into the address bar and there is no such port, I get a pretty useless 404 page. It would be great if that page could suggest other categories in which the port is found.

The context is that I often look up a port by typing in the URL directly, but may get the primary category wrong. If the 404 page would show other categories that have the port, it would be easy to recover from typing the wrong category. Status code should still be 404 though.

@dlangille
Copy link
Contributor

What came to mind reading this: the existing feature wherein /package=anvil in the URL takes you to that package.

The same code used for that could be used for this.

@dlangille dlangille self-assigned this Jan 6, 2025
@grahamperrin
Copy link
Contributor

Thanks! Neat.

Without wishing to complicate this issue: some kind of fuzzy matching will be ideal.

For example:

– that is, squashfuse without the fusefs- name prefix.

https://github.com/freebsd/freebsd-ports/blob/41dd30fd10f763ebc2e9d69326f6a8e58984c079/MOVED#L3678


Noted: https://news.freshports.org/category/categories/

Side note for @dlangille, if you haven't already seen it, I pinged you at https://discord.com/channels/727023752348434432/757543661058654269/1325715356966322196 with an offer of a PR for a #moves anchor, and:

Should I add an issue to review positioning of the Port Moves table?

@dlangille
Copy link
Contributor

dlangille commented Jan 12, 2025

For sounds like, the search page already uses levenshtein:

https://github.com/FreshPorts/freshports/blob/main/www/search.php#L486

The functions are in the database and are supplied by databases/postgresql16-contrib:

[14:15 pg03 dvl ~] % psql freshports.dvl
psql (16.5)
Type "help" for help.

freshports.dvl=# \df *lev*
                                             List of functions
 Schema |          Name          | Result data type |              Argument data types               | Type 
--------+------------------------+------------------+------------------------------------------------+------
 public | levenshtein            | integer          | text, text                                     | func
 public | levenshtein            | integer          | text, text, integer, integer, integer          | func
 public | levenshtein_less_equal | integer          | text, text, integer                            | func
 public | levenshtein_less_equal | integer          | text, text, integer, integer, integer, integer | func
(4 rows)

freshports.dvl=# 

@dlangille
Copy link
Contributor

Noted: https://news.freshports.org/category/categories/

What about that^ ?

Side note for @dlangille, if you haven't already seen it, I pinged you at https://discord.com/channels/727023752348434432/757543661058654269/1325715356966322196 with an offer of a PR for a #moves anchor, and:

Should I add an issue to review positioning of the Port Moves table?

"Never ask to ask" - just create the thing. :)

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

3 participants