No problem; I love to help where I can! To address your two points: 1. There is no particular reason for `rpc` and `web` being chosen; I just needed separate values for this patch to be tested with. I'm up to renaming them to anything if we decide to use `search_type`. 2. It would not be much more work to add the quoted stanza -- I had an idea to at one point, but just decided to back off from it; figured just introducing the patch would get some conversation about it on the ML. I'll start working on a follow-up patch that implements this as well. The refraining from #2 is due to me being a bit worried due to it changing how the API behaves, didn't think about the complete picture ("arch linux" second_keyword). I'll start working on that now. My tasks: 1. Rename search_type values to something more sensible (waiting on this for feedback from ML) 2. Implement support for quoted strings in the search arg: "arch linux". Quoted keywords will be taken literally -- that is, "arch linux" would trigger a search for the literal 'arch linux' string. Thanks for the follow-up, Lukas; I'm on it! On Thu, Jul 2, 2020 at 4:46 PM Lukas Fleischer <lfleischer@archlinux.org> wrote:
Hi Kevin,
Thanks for the patch!
On Tue, 30 Jun 2020 at 19:36:01, Kevin Morris wrote:
This commit introduces new functionality: When `search_type` is `web`, search behavior matches aurweb's HTML search page.
New parameters: `search_type` Valid search_type values: `rpc` (default), `web`
The `rpc` search type uses the existing legacy search method.
The `web` search type clontes the web-based aurweb search page's behavior as closely as possible (see note at the bottom of this message).
The following example searches for packages that contain `blah` AND `abc`:
https://aur.archlinux.org/rpc/?v=5&type=search&search_type=web&arg=blah%20abc
The legacy method still searches for packages that contain 'blah abc': https://aur.archlinux.org/rpc/?v=5&type=search&arg=blah%20abc
https://aur.archlinux.org/rpc/?v=5&type=search&search_type=rpc&arg=blah%20abc
Before having a look at the implementation, is there any reason the two search types are called "rpc" and "web" (other than "rpc" is how the RPC interface used to behave and "web" is how the RPC interface used to behave)? If not, I think we should choose a different naming that is more intuitive and self-explanatory.
Going a step further, would it be much more work to instead make the interface more powerful, use conjunctive search by default and perform exact matches for phrases put in quotes, such as
"arch linux" package
matching everything that contains the strings "arch linux" and "package"? With that, we wouldn't even have to distinguish different search types (but we may need to bump the API version).
Best regards, Lukas
-- Kevin Morris Software Developer Personal Inquiries: kevr.gtalk@gmail.com Personal Phone: (415) 583-9687 Technologies: C, C++, Python, Django, Ruby, Rails, ReactJS, jQuery, Javascript, SQL, Redux