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

feat: add opensearch suggestion endpoints #6

Merged
merged 1 commit into from
Aug 30, 2023
Merged

feat: add opensearch suggestion endpoints #6

merged 1 commit into from
Aug 30, 2023

Conversation

dpeukert
Copy link
Contributor

Hi, this PR implements two suggest endpoints based on the OpenSearch specification, which enables browsers to use them for search suggestions.

@moson-mo
Copy link
Owner

Hi @dpeukert, thanks for your PR.

Hmm, sounds interesting. Do you have some specific use-case for this?

If I understand this correctly, it's meant for someone hosting a (search) website: They can basically add some OpenSearch description file (with the URL to the suggest endpoint) and advertise that to browsers via a link on their page as kind of browser plugin.

@dpeukert
Copy link
Contributor Author

The end-goal is to add a OpenSearch description to the main AUR site (see the description for the main Arch site for an example).

What this PR does is add an endpoint that can be used by the user's browser (if defined in the OS description) to return package name suggestions while searching using the custom search engine provided by the description. The main arch site also has an implementation of this.

@moson-mo
Copy link
Owner

moson-mo commented Aug 30, 2023

What this PR does is add an endpoint that can be used by the user's browser

Yeah, I get that.

to return package name suggestions while searching using the custom search engine provided by the description

We already got that in AUR as well though (utilizing the current suggest call):

image

Now archweb also has this. But they also invoke this via JS. So I'm wondering where that OpenSearch thing comes into play.

@dpeukert
Copy link
Contributor Author

The OpenSearch description would enable you to basically do the same thing, but directly from the browser search bar, without having to go the AUR (you can set a keyword for the search engine, so if you typed aur test for example, you would get the same suggestion as in the screenshot).

The existing suggest would be fine for this, but unfortunately, the specification also requires the search term to be sent back as part of the response.

@moson-mo
Copy link
Owner

but directly from the browser search bar

Aha. How do I enable this stuff?

It's not that "Add keyword for this Search..." (firefox) thing, is it? It does search, but not -auto-suggest while typing- for me (trying on archweb) 🤔

image

@dpeukert
Copy link
Contributor Author

It's not very intuitive to be honest, but you right click on the address bar, click 'Add "Arch Linux Packages"', then you go to Settings > Search > Search Shortcuts and add a keyword there.

@dpeukert
Copy link
Contributor Author

I'll merge in master and add the content-type tests for the new endpoints.

@moson-mo
Copy link
Owner

It's not very intuitive to be honest

Hehe, not really 😄. Thanks for the info.

Could you rebase? Just merged your other changes...

@dpeukert
Copy link
Contributor Author

@moson-mo Should be ready to merge.

@moson-mo
Copy link
Owner

@dpeukert If you care about the commit signature, could you rebase to main and squash them commits instead? Otherwise I'll squash them... (sorry, I somwhat became allergic to merge commits)

@dpeukert
Copy link
Contributor Author

No worries, rebased and squashed.

@moson-mo moson-mo merged commit 346f7fe into moson-mo:main Aug 30, 2023
1 check passed
@moson-mo
Copy link
Owner

@dpeukert Thank you.

@dpeukert dpeukert deleted the feature/opensearch-suggest branch August 30, 2023 20:55
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

Successfully merging this pull request may close these issues.

2 participants