Is it possible to have a solr join query only apply under certain conditions?
We have a solr document store that performs access control following various
rules related to the data stored in solr. Consider the following scenario
{
Id:"doc1"
linkedIDs:"doc2"
Desc:"desc 1"
Group:"1"
}
{
Id:"doc2"
Desc:"desc 2"
Group:"2"
}
{
Id:"doc3"
Desc:"desc 3"
Group:"3"
}
Suppose Internally for a given user we have a rule that says user cannot see
anything with Group = "2". Therefore our system augments the following user
specified query q=Id:* and translates that to q=Id:* AND !Group:2
This results in the search response containing:
{
Id:"doc1"
linkedIDs:"doc2"
Desc:"desc 1"
Group:"1"
}
{
Id:"doc3"
Desc:"desc 3"
Group:"3"
}
However I'd like to somehow leverage join to make it so the user will also not
get back results that Link/reference products they can't see. Such that they'd
only get back
{
Id:"doc3"
Desc:"desc 3"
Group:"3"
}
Is it possible to formulate a query like this?