Torben,

Denormalization implies copying attrs which are common for a group into the
smaller docs:

<doc>
  <str name="setid">3</str>
  <str name="attribute_A>value</str>
  <str name="attribute_B>value</str>
  <str name="options">A</str>
  <str name="value">200</str>
</doc>
<doc>
  <str name="setid">3</str>
  <str name="attribute_A>value</str>
  <str name="attribute_B>value</str>
  <str name="options">B</str>
  <str name="value">400</str>
</doc>
<doc>
  <str name="setid">3</str>
  <str name="attribute_A>value</str>
  <str name="attribute_B>value</str>
  <str name="options">B</str>
  <str name="value">400</str>
</doc>
<doc>
  <str name="setid">3</str>
  <str name="attribute_A>value</str>
  <str name="attribute_B>value</str>
  <str name="options">C</str>
  <str name="value">240</str>
</doc>

and use group.facet=true

On Sat, Oct 6, 2012 at 2:24 AM, Torben Honigbaum <
torben.honigb...@neuland-bfi.de> wrote:

> Hi Mikhail,
>
> thank you for your answer. Maybe my sample data was a not so god. The
> document always have additional data which I need to use as facet like this:
>
> <doc>
>   <str name="id">3</str>
>   <str name="attribute_A>value</str>
>   <str name="attribute_B>value</str>
>   <str name="options">
>     <str>A</str>
>     <str>B</str>
>     ...
>   <str>
>   <str name="value">
>     <str>200</str>
>     <str>400</str>
>     ...
>   <str>
> </doc>
>
> Torben
>
> Am 05.10.2012 um 17:20 schrieb Mikhail Khludnev:
>
> > denormalize your docs to option x value tuples, identify them by duping
> id.
> >
> > <doc>
> >  <str name="setid">3</str>
> >  <str name="options">A</str>
> >  <str name="value">200</str>
> > </doc>
> > <doc>
> >  <str name="setid">3</str>
> >  <str name="options">B</str>
> >  <str name="value">400</str>
> > </doc>
> > <doc>
> >  <str name="setid">3</str>
> >  <str name="options">B</str>
> >  <str name="value">400</str>
> > </doc>
> > <doc>
> >  <str name="setid">3</str>
> >  <str name="options">C</str>
> >  <str name="value">240</str>
> > </doc>
> >
> > then collapse them by set "setid" field. (it can not be uniqkey).
> >
> > On Fri, Oct 5, 2012 at 6:26 PM, Torben Honigbaum <
> > torben.honigb...@neuland-bfi.de> wrote:
> >
> >> Hi Mikhail,
> >>
> >> I read the article and can't see how to solve my problem with
> >> FieldCollapsing.
> >>
> >> Any other suggestions?
> >>
> >> Torben
> >>
> >> Am 04.10.2012 um 17:31 schrieb Mikhail Khludnev:
> >>
> >>> it's a typical nested document problem. there are several approaches.
> Out
> >>> of the box solution as far you need facets is
> >>> http://wiki.apache.org/solr/FieldCollapsing .
> >>>
> >>> On Thu, Oct 4, 2012 at 7:19 PM, Torben Honigbaum <
> >>> torben.honigb...@neuland-bfi.de> wrote:
> >>>
> >>>> Hi Jack,
> >>>>
> >>>> thank you for your answer. The problem is, that I don't know the value
> >> for
> >>>> option A and that the values are numbers and I've to use the values as
> >>>> facet. So I need something like this:
> >>>>
> >>>> Docs:
> >>>>
> >>>> <doc>
> >>>> <str name="id">3</str>
> >>>> <str name="options">
> >>>>   <str>A</str>
> >>>>   <str>B</str>
> >>>>   ...
> >>>> <str>
> >>>> <str name="value">
> >>>>   <str>200</str>
> >>>>   <str>400</str>
> >>>>   ...
> >>>> <str>
> >>>> </doc>
> >>>> <doc>
> >>>> <str name="id">4</str>
> >>>> <str name="options">
> >>>>   <str>A</str>
> >>>>   <str>E</str>
> >>>>   ...
> >>>> <str>
> >>>> <str name="value">
> >>>>   <str>300</str>
> >>>>   <str>400</str>
> >>>>   ...
> >>>> <str>
> >>>> </doc>
> >>>> <doc>
> >>>> <str name="id">6</str>
> >>>> <str name="options">
> >>>>   <str>A</str>
> >>>>   <str>C</str>
> >>>>   ...
> >>>> <str>
> >>>> <str name="value">
> >>>>   <str>200</str>
> >>>>   <str>400</str>
> >>>>   ...
> >>>> <str>
> >>>> </doc>
> >>>>
> >>>> Query: …?q=options:A
> >>>>
> >>>> Facet: 200 (2), 300 (1)
> >>>>
> >>>> Thank you
> >>>> Torben
> >>>>
> >>>> Am 04.10.2012 um 17:10 schrieb Jack Krupansky:
> >>>>
> >>>>> Use a field called "option_value_pairs" with values like "A 200" and
> >>>> then query with a quoted phrase "A 200".
> >>>>>
> >>>>> You could use a special character like equal sign instead of space:
> >>>> "A=200" and then you don't have to quote it in the query.
> >>>>>
> >>>>> -- Jack Krupansky
> >>>>>
> >>>>> -----Original Message----- From: Torben Honigbaum
> >>>>> Sent: Thursday, October 04, 2012 11:03 AM
> >>>>> To: solr-user@lucene.apache.org
> >>>>> Subject: Problem with relating values in two multi value fields
> >>>>>
> >>>>> Hello,
> >>>>>
> >>>>> I've a problem with relating values in two multi value fields. My
> >>>> documents look like this:
> >>>>>
> >>>>> <doc>
> >>>>> <str name="id">3</str>
> >>>>> <str name="options">
> >>>>> <str>A</str>
> >>>>> <str>B</str>
> >>>>> <str>C</str>
> >>>>> <str>D</str>
> >>>>> <str>
> >>>>> <str name="value">
> >>>>> <str>200</str>
> >>>>> <str>400</str>
> >>>>> <str>240</str>
> >>>>> <str>310</str>
> >>>>> <str>
> >>>>> </doc>
> >>>>>
> >>>>> My problem is that I've to search for a set of documents and display
> >>>> only the value for option A, for example, and use the value field as
> >> facet
> >>>> field. I need a result like this:
> >>>>>
> >>>>> <doc>
> >>>>> <str name="id">3</str>
> >>>>> <str name="options">A</str>
> >>>>> <str name="value">200</str>
> >>>>> </doc>
> >>>>> <facet> …
> >>>>>
> >>>>> I think that this is a use case which isn't possible, right? So can
> >>>> someone show me an alternative way to solve this problem? The
> documents
> >>>> each have 500 options with 500 related values.
> >>>>>
> >>>>> Thank you
> >>>>> Torben
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Sincerely yours
> >>> Mikhail Khludnev
> >>> Tech Lead
> >>> Grid Dynamics
> >>>
> >>> <http://www.griddynamics.com>
> >>> <mkhlud...@griddynamics.com>
> >>
> >>
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > Tech Lead
> > Grid Dynamics
> >
> > <http://www.griddynamics.com>
> > <mkhlud...@griddynamics.com>
>
>


-- 
Sincerely yours
Mikhail Khludnev
Tech Lead
Grid Dynamics

<http://www.griddynamics.com>
 <mkhlud...@griddynamics.com>

Reply via email to