lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: Generating a document by group count and displaying the result
Date Wed, 16 Sep 2015 15:39:50 GMT
Have you looked at the group by options? See:
https://cwiki.apache.org/confluence/display/solr/Result+Grouping

Best,
Erick

On Tue, Sep 15, 2015 at 5:00 AM, Sreekant Sreedharan
<sreekants@alamy.com> wrote:
> I have a requirement to group documents by count based on a particular field:
>
> So for example if you have the following three documents:
>    <doc>
>           <id>1</id>
>           <category>food</category>
>           <body>car</body>
>    </doc>
>    <doc>
>           <id>2</id>
>           <category>travel</category>
>           <body>car</body>
>    </doc>
>    <doc>
>           <id>3</id>
>           <category>food</category>
>           <body>car</body>
>    </doc>
>
> A search with the query string 'car' based on a grouping based on the
> 'category' field should return something like:
>
>    <doc>
>           <id>1</id>
>           <category>food</category>
>           <body>car</body>
>           <category_count>2</category_count>
>    </doc>
>    <doc>
>           <id>2</id>
>           <category>travel</category>
>           <body>car</body>
>           <category_count>1</category_count>
>    </doc>
>    <doc>
>           <id>3</id>
>           <category>food</category>
>           <body>car</body>
>           <category_count>2</category_count>
>    </doc>
>
> Is this possible?
>
> Regards,
> Sreekant
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Generating-a-document-by-group-count-and-displaying-the-result-tp4229183.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message