On 30. nov. 2011 14:58, Martijn v Groningen wrote:
You'll need to create a new second pass collector
that computes the min / max for the top N groups. This collector then
needs to
be wired up in Solr. The AbstractSecondPassGroupingCollector is
something you can take a look at. It collects the top documents for
the top N groups.

I've spent some time looking at this code, and I could use a few more pointers to see if my assumptions are right, and get some idea of where I'm headed.

As far as I understand, I need to create a subclass of AbstractSecondPassGroupingCollector, and for each group maintain some sort of structure to hold on to my values.

As to getting the values, I think I understand how it works, but if anyone could point me towards some documentation about how the AtomicReaderContext works, and how to read specific fields, that would be great.

My biggest question at the moment is how to get my values into the response?

I was thinking I should create an new Grouping.Command that did this, but then it seems I can't include the values directly with each group (the lists in the "groups" element), but would need to add a separate structure with the values for each group. Am I right in that assumption? How can I add more values to the lists in the "groups" element? Which behavior would be preferred?


I was hoping to end up with a response that looks sort of like the attached XML.

--
Morten
We all live in a yellow subroutine.
<response>
  <lst name="grouped">
    <lst name="collapse_id">
      <int name="matches">548</int>
      <arr name="groups">
        <lst>
          <str name="groupValue">00000000000E4610:airtoursno</str>
          <result name="doclist" numFound="1" start="0">
            <doc>
              <int name="price">3599</int>
              <str name="collapse_id">00000000000E4610:airtoursno</str>
            </doc>
          </result>
          <lst name="stats">
            <lst name="price">
              <int name="min">3200</int>
              <int name="max">5000</int>
            </lst>
          </lst>
        </lst>
        <lst>
          <str name="groupValue">00000000001DB079:airtoursno</str>
          <result name="doclist" numFound="1" start="0">
            <doc>
              <int name="price">2968</int>
              <str name="collapse_id">00000000001DB079:airtoursno</str>
            </doc>
          </result>
          <lst name="stats">
            <lst name="price">
              <int name="min">2500</int>
              <int name="max">3000</int>
            </lst>
          </lst>
        </lst>
      </arr>
    </lst>
  </lst>
</response>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to