Hi Joe,

Currently the patch does not do that, but you can do something else
that might help you in getting your summed stock.

In the latest patch you can include fields of collapsed documents in
the result per distinct field value.
If your specify collapse.includeCollapseDocs.fl=num_in_stock in the
request nd lets say you collapse on brand then in the response you
will receive the following xml:
<lst name="collapsedDocs">
   <result name="brand1" numFound="48" start="0">
        <doc>
          <str name="num_in_stock">2</str>
        </doc>
         <doc>
          <str name="num_in_stock">3</str>
        </doc>
      ...
   </result>
   <result name=”brand2” numFound=”9” start=”0”>
      ...
   </result>
</lst>

On the client side you can do whatever you want with this data and for
example sum it together. Although the patch does not sum for you, I
think it will allow to implement your requirement without to much
hassle.

Cheers,

Martijn

2009/10/1 Matt Weber <m...@mattweber.org>:
> You might want to see how the stats component works with field collapsing.
>
> Thanks,
>
> Matt Weber
>
> On Sep 30, 2009, at 5:16 PM, Uri Boness wrote:
>
>> Hi,
>>
>> At the moment I think the most appropriate place to put it is in the
>> AbstractDocumentCollapser (in the getCollapseInfo method). Though, it might
>> not be the most efficient.
>>
>> Cheers,
>> Uri
>>
>> Joe Calderon wrote:
>>>
>>> hello all, i have a question on the field collapsing patch, say i have
>>> an integer field called "num_in_stock" and i collapse by some other
>>> column, is it possible to sum up that integer field and return the
>>> total in the output, if not how would i go about extending the
>>> collapsing component to support that?
>>>
>>>
>>> thx much
>>>
>>> --joe
>>>
>>>
>
>

Reply via email to