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

Search categories? #473

Closed
patmaddox opened this issue Oct 19, 2023 · 16 comments
Closed

Search categories? #473

patmaddox opened this issue Oct 19, 2023 · 16 comments
Assignees

Comments

@patmaddox
Copy link

I want to view a list of ports in ports-mgmt, ordered by most recently updated. Is there a way to do that? The closest I’ve found is “under a pathname” which looks like it returns commits rather than port information.

@dlangille
Copy link
Contributor

We have https://www.freshports.org/ports-mgmt/

But you can't search that.

@dlangille
Copy link
Contributor

This search query comes to mind: site:www.freshports.org/net-mgmt/ - use it on DuckDuckGo or Google, for example.

@dlangille
Copy link
Contributor

The technical side is straight forward. I'm having trouble coming up with the user interface.

select * from ports where name ilike '%search_string%' and category = 'foo'

@patmaddox
Copy link
Author

Searching within a category would be cool, and is above and beyond what I was thinking.

I had in mind a “category” option in the main search drop down list. My use case is wanting to list all ports in a category, ordered by when last updated.

So..l maybe you want to add sort links on the category page, or some way of searching categories.

but for my purposes, adding “category” to the drop-down list on search page does the job.

@grahamperrin
Copy link
Contributor

Drive-by comment (without giving real thought):

https://www.freshports.org/ports-mgmt/ add Sort by

@dlangille
Copy link
Contributor

Drive-by comment (without giving real thought):

https://www.freshports.org/ports-mgmt/ add Sort by

Right now, it's sorted by portname. What other options are useful?

@dlangille
Copy link
Contributor

but for my purposes, adding “category” to the drop-down list on search page does the job.

I have changes underway for #447 which affect search already.

I'll either commit them and work on this, or do them both at the same time. We shall see.

@patmaddox
Copy link
Author

Right now, it's sorted by portname. What other options are useful?

I would like to be able to sort by created, and updated.

@dlangille
Copy link
Contributor

dlangille commented Nov 1, 2023

First draft of search by category. Not widely tested. There are probably some combinations which are illogical.

I can search for my commits in a given category, for example.

EDIT: I notice that my solution is valid only for physical categories, not virtual categories. I'll work on the latter.

EDIT: now working for virtual categories.

@dlangille
Copy link
Contributor

For me, later. This will be used to update the cached list of categories, so that each load of search.php does not query for the last of categories.

freshports.devgit=# select '            <OPTION VALUE="' || name || '" <?php if ($category == ''' || name || ''') echo ''SELECTED''?>>' || name || '</OPTION>' from categories order by name;
                                                                ?column?                                                                 
-----------------------------------------------------------------------------------------------------------------------------------------
                 <OPTION VALUE="accessibility" <?php if ($category == 'accessibility') echo 'SELECTED'?>>accessibility</OPTION>
                 <OPTION VALUE="afterstep" <?php if ($category == 'afterstep') echo 'SELECTED'?>>afterstep</OPTION>
                 <OPTION VALUE="arabic" <?php if ($category == 'arabic') echo 'SELECTED'?>>arabic</OPTION>
                 <OPTION VALUE="archivers" <?php if ($category == 'archivers') echo 'SELECTED'?>>archivers</OPTION>
,,,

@patmaddox
Copy link
Author

I must be dense - how do I view ports-mgmt ports ordered by updated at?

@patmaddox
Copy link
Author

Perhaps this is a clue on the search page:

The list of categories is not available - the cache file does not exist - This should never happen.

@dlangille
Copy link
Contributor

@patmaddox This is fixed in dev and test. stage has always been updated but not yet tested. Same with prod.

@dlangille
Copy link
Contributor

Perhaps this is a clue on the search page:

The list of categories is not available - the cache file does not exist - This should never happen.

This is what I mean by 'fixed' in my previous comment.

@patmaddox
Copy link
Author

Cool, I’m now able to view all ports in a category sorted by last updated by searching for (space) in the description - thank you!!

@dlangille
Copy link
Contributor

Cool, I’m now able to view all ports in a category sorted by last updated by searching for (space) in the description - thank you!!

A proper sort within category will be carried out under #490

@dlangille dlangille self-assigned this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants