Hello,
I am playing with joins here just to test what I can do with them. I
have been learning a lot, but I am still having some troubles with more
complex queries.
For example, suppose I have the following documents:
- id = 1 - name = Humblebee - age = 1000
- id = 2 - type = arm - attr1 = left - size = 45 - unit = cm - root_id =
1
- id = 3 - type = arm - attr1 = right - size = 46 - unit = cm - root_id
= 1
- id = 4 - type = leg - attr1 = left - size = 50 - unit = cm - root_id =
1
- id = 5 - type = leg - attr1 = right - size = 52 - unit = cm - root_id
= 1
In my case, that would mean there is a body called humblebee with id 1
and 4 child, each one a member of the body.
What I am trying to do: select all bodies (root entities) that have a
left arm and a right leg.
To select the body based on the left arm, I would do:
- q = *:*
- fq = {!join from=root_id to=id}type:arm&attr1=left
To select the body based on the right leg:
- q = *:*
- fq = {!join from=root_id to=id}type:leg&attr1=right
But what if I need both left arm AND right leg? Should I do 2 joins?
Best regards,
--
Marcelo Elias Del Valle
http://mvalle.com - @mvallebr