On Thu, Mar 17, 2011 at 11:21 AM, Otis Gospodnetic
<otis_gospodne...@yahoo.com> wrote:
> Hi,
>
>
>
> ----- Original Message ----
>> From: Yonik Seeley <yo...@lucidimagination.com>
>> Subject: Re: Parent-child options
>>
>> On Thu, Mar 17, 2011 at 1:49 AM, Otis Gospodnetic
>> <otis_gospodne...@yahoo.com>  wrote:
>> > The dreaded parent-child without denormalization question.  What  are one's
>> > options for the following example:
>> >
>> > parent:  shoes
>> > 3 children. each with 2 attributes/fields: color and size
>> >   * color: red black orange
>> >  * size: 10 11 12
>> >
>> > The goal is  to be able to search for:
>> > 1) color:red AND size:10 and get 1 hit for the  above
>> > 2) color:red AND size:12 and get *no* matches because there are no  red 
>> > shoes
>>of
>> > size 12, only size 10.
>>
>> What if you had this  instead:
>>
>>   color: red red orange
>>   size: 10 11 12
>>
>> Do  you need for color:red to return 1 or 2 (i.e. is the final answer
>> in units of  child hits or parent hits)?
>
> The final answer is the parent, which is "shoes" in this example.
> So:
> if the query is color:red AND size:10 the answer is: Yes, we got red shoes 
> size
> 10
> if the query is color:red AND size:11 the answer is: Yes, we got red shoes 
> size
> 11
> if the query is color:red AND size:12 the answer is: No, we don't have red 
> shoes
> size 12

Then yes, the join patch would work (as long as it's just filtering
and you don't need relevancy of child hits to propagate to the
parent).

parent {category:"shoes"}
child {parent:"shoes", color:"red", size:10}

q={!join from=parent to=category}color:red AND size:10

If you had a query on the parent type docs, the join could also be
used as an "fq".

-Yonik
http://lucidimagination.com

Reply via email to