I didn’t get your point.
As I have already explained my requirements, if I use filter it will give me only exact match. And if I use different method having filter like for eg:-
get A
get B
get C
get A&B
get B&C
get C&A
get A&B&C
I want A intersection B intersection C.
But I cann’t use filter because either user can provide A, B, C, AB, BC, CA or ABC.
So for filter one variable should be permanent which will used in function then we can apply others in filter.
So I decided different approach by getting
A, B, C, AB, BC, CA, ABC as per user, then find intersection of all these.
@pawan, Example: Get allCars and get all carsWithOil, then subtract carsWithOil from allCars without using filters. Because car may not have relates_to predicate always. Therefore, we need to make two query blocks. Then subtract carsWithOil from another allCars. Then print all cars that has not relates_to-> oil.
carsWithOil as var(func: has(car) ) @cascade
{
name
relates_to @filter(has(oil)) {
name
}
}
allCars as var(func: has(car) ) {
name
}
@pawan, another example will be, get trucks and cars, then merge uids of both queries, then print all.
One of solution will be to use OR.
query(func: has(car) OR has(truck) )
{
uid
}
It works fine for basic cases, What if we need to filter cars and trucks with different criteria? ex: get trucks that name starts with some_word and get cars that has driver predicate true.
@pawan,
I looked dgraph documentation, specially query language. Nothing mentioned about unions, intersections?
How to get union of two uid list?
How to subtract uid list from another uid list?
Simple examples will be helpful
But the issue is current_status, preferred_location1 and preferred_location2 is not compulsory and skill is must required, So I want to do something like this
{
searchSkill(func: anyofterms(skill_name, "Java, Angularjs")){
uid
}
method to get user uid having current_status
method to get user uid for preferred_location1 and preferred_location2
then method to get intersection of uid(of above output)
So, I f there is not intersection, then can provide some other way to complete my task.