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>

Reply via email to