FS#49133 - AUR RPC cannot provide same results as AUR site search

Attached to Project: AUR web interface
Opened by Igor (f2404) - Friday, 29 April 2016, 09:45 GMT
Last edited by Jonas Witschel (diabonas) - Tuesday, 02 November 2021, 10:23 GMT
Task Type Support Request
Category Backend
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version 4.2.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

When searching by multiple arguments (e.g. 'git client'), AUR site search seems to use AND operation, i.e. the search results will contain 'git' AND 'client' (378 results total at the moment).

How can the same be achieved by using AUR RPC?
If I search for 'git client' (https://aur.archlinux.org/rpc/?v=5&type=search&arg=git%20client), I get 2 results.
If I provide both arguments separately (https://aur.archlinux.org/rpc/?v=5&type=search&arg=git&arg=client), I get 1370 results - looks like OR operation is used.
This task depends upon

Closed by  Jonas Witschel (diabonas)
Tuesday, 02 November 2021, 10:23 GMT
Reason for closing:  Implemented
Additional comments about closing:  https://lists.archlinux.org/pipermail/au r-dev/2020-July/004937.html
Comment by Johannes Löthberg (demize) - Thursday, 03 November 2016, 00:11 GMT
So, seems the problem is that the web search splits on spaces and then adds a match for each part, while the RPC only adds a clause for the full string.
Comment by Kevin Morris (kevr) - Monday, 29 June 2020, 16:53 GMT
I'll work on a patch so the rpc does the same with arguments including spaces, so they end up giving identical results.
Comment by Kevin Morris (kevr) - Tuesday, 30 June 2020, 16:43 GMT
*UPDATED*

Plan for legacy + patch support:

A new API version 6 allows the user to take advantage of new search criteria: When searching with `v=6` by `name` or `name-desc`, return all packages containing _all_ keywords given (quoted substrings are preserved).

Examples:

Search for packages containing literal `blah blah`:
curl 'https://aur.archlinux.org/rpc/?v=6&type=search&arg="blah blah"'

Search for packages containing literal `blah blah` AND `ha ha`:
curl 'https://aur.archlinux.org/rpc/?v=6&type=search&arg="blah blah"%20"ha ha"'

Search for packages containing `blah` AND `hah`:
curl 'https://aur.archlinux.org/rpc/?v=6&type=search&arg=blah%20hah'

Using `v=5` preserves the current (legacy) behavior.
Comment by Kevin Morris (kevr) - Tuesday, 30 June 2020, 23:38 GMT
**UPDATED**

A message titled "[PATCH] Bump RPC API Version 6" has been submitted to aur-dev@archlinux.org regarding this task.
Comment by Kevin Morris (kevr) - Monday, 06 July 2020, 23:47 GMT Comment by Kevin Morris (kevr) - Thursday, 19 August 2021, 20:44 GMT
This is now totally bugged in `pu`, as of checking recently. We're addressing this in the Python FastAPI port.

Loading...