Closed alivannikov closed 1 year ago
the AND semantics is the one that you can NOT emulate. the OR semantics can be emultated with just doing 2 requests, one for the first tag and one for the second and combining the result. i will not change the default behaviour to OR semantics because of that. but i also think, that there should be a way to ask the API for TAG1 OR TAG2, this will be an additional feature in the endpoint i have to think about. it should be not to complicated. thanks for your input!
You can easily emulate AND semantics by following the same logic. Just doing 2 requests, but taking intersection of results, not union. But yes, OR semantics can be separate endpoint/operation of course. Thank you for considering implementation of this feature!
@segler-alex Does this require something else except concatenating LIKE clauses from tagList with OR instead of AND here: https://github.com/segler-alex/radiobrowser-api-rust/blob/master/src/db/db_mysql/mod.rs#L546 And adding new endpoint parameter (if we want to keep old one)?
it would work, if the user does only send tags and nothing else. you could add "(" and ")" arround the whole task list so the rest will not get destroyed by it.
do you think only tags should have or semantics or do you think all search attributes should be combined with or?
No no, different search attributes should be combined with AND of course. I think this is how filtering usually works on search related web sites. Filters are combined with AND, filter values inside particular filter with OR. For example on clothes shop it may be size and color filters. You select 'black', 'blue', 'M', 'L'. So, naturally speaking you are looking for black or blue jacket which is size M or L. It does not make sense to query for size M AND L, it will always lead to empty result. From other side you do not want to see all M jackets, but only black or blue ones. It will not work if you combine size and color with OR.
@segler-alex Would you mind to do this small change? I have some troubles to set up local env to verify that it actually works.
Currently tags in
tagList
parameter haveAND
semantics, meaning that all values should match. HoweverOR
semantics may be more useful in practice. For example I am interested in Death Metal music and 60s music. This is rare combination to be present in one particular station and most probably such request will lead to empty result set. However, what user really wants to be returned is Death Metal stations + 60s stations.