You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bhoomit Vasani <bh...@gmail.com> on 2014/05/27 08:28:31 UTC
Grouping on a multi-valued field
Hi,
Does latest release of solr supports grouping on a multi-valued field?
According to this
https://wiki.apache.org/solr/FieldCollapsing#Known_Limitations it doesn't,
but the doc was last updated 14 months ago...
--
--
Thanks & Regards,
Bhoomit Vasani | SE @ Mygola
WE are LIVE <http://www.mygola.com/>!
91-8892949849
Re: Grouping on a multi-valued field
Posted by Bhoomit Vasani <bh...@gmail.com>.
Hi Erick,
Thanks again, I'm using the same thing as workaround. I first use "pivot
faceting" and another call to fetch actual documents.
On Fri, May 30, 2014 at 9:46 PM, Erick Erickson <er...@gmail.com>
wrote:
> OK, I see what you're trying to do. Unfortunately grouping is just not
> built to support multivalued fields. The nearest thing I can think of is
> "pivot faceting", but that only returns counts, not the actual documents.
>
> Sorry I can't be more help
> Erick
>
>
> On Fri, May 30, 2014 at 3:44 AM, Bhoomit Vasani <bh...@gmail.com>
> wrote:
>
> > Hi Erick,
> >
> > Thanks for the response.
> >
> > What am I trying to do? :
> >
> > I have a multivalued field called tags for e.g.
> >
> > - {
> > - id: "1",
> > - *tags*:["solr","lucene","facet"],
> > *type*:"post"
> > },
> > - {
> > - id: "2",
> > - *tags*:["solr","multi-valued","grouping"],
> > *type*:"quote"
> > },
> >
> > .......
> >
> >
> > Now what I want is...
> > grouped:
> > {
> >
> > - type:
> > {
> > - matches: 578,
> > - groups:
> > [
> > -
> > {
> > - groupValue: "solr",
> > - doclist:
> > {
> > - numFound: 365,
> > - start: 0,
> > - docs:
> > [
> > -
> > {
> > - id: "1",
> > - *tags*:["solr","lucene","facet"],
> > *type*:"post"
> > },
> > - {
> > - id: "2",
> > - *tags*:["solr","multi-valued","grouping"],
> > *type*:"quote"
> > },
> > -
> > ]
> > }
> > },
> > - {
> > - groupValue: "lucene",
> > - doclist:
> > {
> > - numFound: 365,
> > - start: 0,
> > - docs:
> > [
> > -
> > {
> > - id: "1",
> > - *tags*:["solr","lucene","facet"],
> > *type*:"post"
> > },
> > ]
> > }
> > },...
> >
> >
> > But when I run this
> > *
> >
> http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*
> > <
> >
> http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*
> > >*
> > it
> > gives me error saying "*can not use FieldCache on multivalued field:
> > tags*".
> > It works fine on type field which is single valued.
> >
> > Hope the example is clear enough.
> >
> >
> > -
> >
> >
> >
> >
> >
> >
> > On Thu, May 29, 2014 at 3:05 AM, Erick Erickson <erickerickson@gmail.com
> >
> > wrote:
> >
> > > what would "grouping on a multivalued field" mean? Count the same doc
> > > separately for each value in the MV field? Use the first value?
> > >
> > > This seems similar to the problem of sorting on fields with more than
> > > one token, any approach I can think of will be wrong.
> > >
> > > But this smells like an XY problem. What is the use-case you're trying
> > > to support? If you tell us that there might be alternate approaches
> > > that would work OOB.
> > >
> > > To answer your question "not that I know of".
> > >
> > > Best
> > > Erick
> > >
> > > On Mon, May 26, 2014 at 11:28 PM, Bhoomit Vasani <
> bhoomit.2010@gmail.com
> > >
> > > wrote:
> > > > Hi,
> > > >
> > > > Does latest release of solr supports grouping on a multi-valued
> field?
> > > >
> > > > According to this
> > > > https://wiki.apache.org/solr/FieldCollapsing#Known_Limitations it
> > > doesn't,
> > > > but the doc was last updated 14 months ago...
> > > >
> > > > --
> > > > --
> > > > Thanks & Regards,
> > > > Bhoomit Vasani | SE @ Mygola
> > > > WE are LIVE <http://www.mygola.com/>!
> > > > 91-8892949849
> > >
> >
> >
> >
> > --
> > --
> > Thanks & Regards,
> > Bhoomit Vasani | SE @ Mygola
> > WE are LIVE <http://www.mygola.com/>!
> > 91-8892949849
> >
>
--
--
Thanks & Regards,
Bhoomit Vasani | SE @ Mygola
WE are LIVE <http://www.mygola.com/>!
91-8892949849
Re: Grouping on a multi-valued field
Posted by Erick Erickson <er...@gmail.com>.
OK, I see what you're trying to do. Unfortunately grouping is just not
built to support multivalued fields. The nearest thing I can think of is
"pivot faceting", but that only returns counts, not the actual documents.
Sorry I can't be more help
Erick
On Fri, May 30, 2014 at 3:44 AM, Bhoomit Vasani <bh...@gmail.com>
wrote:
> Hi Erick,
>
> Thanks for the response.
>
> What am I trying to do? :
>
> I have a multivalued field called tags for e.g.
>
> - {
> - id: "1",
> - *tags*:["solr","lucene","facet"],
> *type*:"post"
> },
> - {
> - id: "2",
> - *tags*:["solr","multi-valued","grouping"],
> *type*:"quote"
> },
>
> .......
>
>
> Now what I want is...
> grouped:
> {
>
> - type:
> {
> - matches: 578,
> - groups:
> [
> -
> {
> - groupValue: "solr",
> - doclist:
> {
> - numFound: 365,
> - start: 0,
> - docs:
> [
> -
> {
> - id: "1",
> - *tags*:["solr","lucene","facet"],
> *type*:"post"
> },
> - {
> - id: "2",
> - *tags*:["solr","multi-valued","grouping"],
> *type*:"quote"
> },
> -
> ]
> }
> },
> - {
> - groupValue: "lucene",
> - doclist:
> {
> - numFound: 365,
> - start: 0,
> - docs:
> [
> -
> {
> - id: "1",
> - *tags*:["solr","lucene","facet"],
> *type*:"post"
> },
> ]
> }
> },...
>
>
> But when I run this
> *
> http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*
> <
> http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*
> >*
> it
> gives me error saying "*can not use FieldCache on multivalued field:
> tags*".
> It works fine on type field which is single valued.
>
> Hope the example is clear enough.
>
>
> -
>
>
>
>
>
>
> On Thu, May 29, 2014 at 3:05 AM, Erick Erickson <er...@gmail.com>
> wrote:
>
> > what would "grouping on a multivalued field" mean? Count the same doc
> > separately for each value in the MV field? Use the first value?
> >
> > This seems similar to the problem of sorting on fields with more than
> > one token, any approach I can think of will be wrong.
> >
> > But this smells like an XY problem. What is the use-case you're trying
> > to support? If you tell us that there might be alternate approaches
> > that would work OOB.
> >
> > To answer your question "not that I know of".
> >
> > Best
> > Erick
> >
> > On Mon, May 26, 2014 at 11:28 PM, Bhoomit Vasani <bhoomit.2010@gmail.com
> >
> > wrote:
> > > Hi,
> > >
> > > Does latest release of solr supports grouping on a multi-valued field?
> > >
> > > According to this
> > > https://wiki.apache.org/solr/FieldCollapsing#Known_Limitations it
> > doesn't,
> > > but the doc was last updated 14 months ago...
> > >
> > > --
> > > --
> > > Thanks & Regards,
> > > Bhoomit Vasani | SE @ Mygola
> > > WE are LIVE <http://www.mygola.com/>!
> > > 91-8892949849
> >
>
>
>
> --
> --
> Thanks & Regards,
> Bhoomit Vasani | SE @ Mygola
> WE are LIVE <http://www.mygola.com/>!
> 91-8892949849
>
Re: Grouping on a multi-valued field
Posted by Bhoomit Vasani <bh...@gmail.com>.
Hi Erick,
Thanks for the response.
What am I trying to do? :
I have a multivalued field called tags for e.g.
- {
- id: "1",
- *tags*:["solr","lucene","facet"],
*type*:"post"
},
- {
- id: "2",
- *tags*:["solr","multi-valued","grouping"],
*type*:"quote"
},
.......
Now what I want is...
grouped:
{
- type:
{
- matches: 578,
- groups:
[
-
{
- groupValue: "solr",
- doclist:
{
- numFound: 365,
- start: 0,
- docs:
[
-
{
- id: "1",
- *tags*:["solr","lucene","facet"],
*type*:"post"
},
- {
- id: "2",
- *tags*:["solr","multi-valued","grouping"],
*type*:"quote"
},
-
]
}
},
- {
- groupValue: "lucene",
- doclist:
{
- numFound: 365,
- start: 0,
- docs:
[
-
{
- id: "1",
- *tags*:["solr","lucene","facet"],
*type*:"post"
},
]
}
},...
But when I run this
*http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*
<http://127.0.0.1:8983/solr/select?wt=json&group=true&group.field=tags&q=*:*>*
it
gives me error saying "*can not use FieldCache on multivalued field: tags*".
It works fine on type field which is single valued.
Hope the example is clear enough.
-
On Thu, May 29, 2014 at 3:05 AM, Erick Erickson <er...@gmail.com>
wrote:
> what would "grouping on a multivalued field" mean? Count the same doc
> separately for each value in the MV field? Use the first value?
>
> This seems similar to the problem of sorting on fields with more than
> one token, any approach I can think of will be wrong.
>
> But this smells like an XY problem. What is the use-case you're trying
> to support? If you tell us that there might be alternate approaches
> that would work OOB.
>
> To answer your question "not that I know of".
>
> Best
> Erick
>
> On Mon, May 26, 2014 at 11:28 PM, Bhoomit Vasani <bh...@gmail.com>
> wrote:
> > Hi,
> >
> > Does latest release of solr supports grouping on a multi-valued field?
> >
> > According to this
> > https://wiki.apache.org/solr/FieldCollapsing#Known_Limitations it
> doesn't,
> > but the doc was last updated 14 months ago...
> >
> > --
> > --
> > Thanks & Regards,
> > Bhoomit Vasani | SE @ Mygola
> > WE are LIVE <http://www.mygola.com/>!
> > 91-8892949849
>
--
--
Thanks & Regards,
Bhoomit Vasani | SE @ Mygola
WE are LIVE <http://www.mygola.com/>!
91-8892949849
Re: Grouping on a multi-valued field
Posted by Erick Erickson <er...@gmail.com>.
what would "grouping on a multivalued field" mean? Count the same doc
separately for each value in the MV field? Use the first value?
This seems similar to the problem of sorting on fields with more than
one token, any approach I can think of will be wrong.
But this smells like an XY problem. What is the use-case you're trying
to support? If you tell us that there might be alternate approaches
that would work OOB.
To answer your question "not that I know of".
Best
Erick
On Mon, May 26, 2014 at 11:28 PM, Bhoomit Vasani <bh...@gmail.com> wrote:
> Hi,
>
> Does latest release of solr supports grouping on a multi-valued field?
>
> According to this
> https://wiki.apache.org/solr/FieldCollapsing#Known_Limitations it doesn't,
> but the doc was last updated 14 months ago...
>
> --
> --
> Thanks & Regards,
> Bhoomit Vasani | SE @ Mygola
> WE are LIVE <http://www.mygola.com/>!
> 91-8892949849