Problem/Motivation
Due to the need of proposing actors in text mentions from following/followers while writing, it will be great to add like queries in a way that lets use for example %/alis% or "https://{$domain}%/{$username}%" . Now is not possible because LIKE conditions in storage query are just available if used with the "search" field.
Proposed resolution
As similar to how conditions are processed in ActivityPubActivityStorage.php:getBaseQuery for example in the case of < operator : (strpos($field, '<') !== FALSE), we could allow LIKE conditionals with :
if (strpos($field, 'LIKE') !== FALSE) {
$operator = 'LIKE';
$field = str_replace('LIKE', '', $field);
}
Comments
Comment #3
aleixComment #4
swentel commentedHmm, I wonder if we also should escape the query as done in the 'search' part in baseQuery, or is it good enough for your use case?
Comment #5
swentel commentedMaybe the escape isn't that necessary, but maybe wildcards are?
Comment #6
aleixI tried to escape and it will escape the wildcards... because we need to look for:
https://{$domain}%/{$username}%
Also, when wildcards are there we end up with something like "%https://{$domain}%/{$username}%", leading to something different to what it is looked for.
Comment #7
swentel commentedright, makes sense. I guess we can use str_contains instead of the strpos call (and replace the rest as well)
Comment #9
swentel commentedMerged in, thanks!