There may be a terminology problem here. In Solr land, "grouping"
aka "field collapsing" governs how the results are returned. But
from your example, it looks like you really want summary counts
rather than return documents grouped by some field.

If you want counting, take a look at "pivot faceting", which
is only available in 4.x.... Here's a place to start:
http://wiki.apache.org/solr/HierarchicalFaceting#Pivot_Facets

And if I've missed the boat entirely, can you clarify?

Best
Erick

On Thu, Jun 6, 2013 at 2:00 AM, Benjamin Ryan
<benjamin.r...@manchester.ac.uk> wrote:
> Hi,
>                Is it possible to create a query similar in function to 
> multiple SQL group by clauses?
>                I have documents that have a single valued fields for host 
> name and collection name and would like to group the results by both e.g. a 
> result would contain a count of the documents grouped by both fields:
>
>                Hostname1 collection1 456
>                Hostname1 collection2 567
>                Hostname2 collection1 123
>                Hostname2 collection2 789
>
>                This is on Solr 3.3 (could be on 4.x) and both fields are 
> single valued with the type:
>
>                <fieldType name="lowerCaseSort" class="solr.TextField" 
> sortMissingLast="true" omitNorms="true">
>                               <analyzer>
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory" />
>                                       <filter class="solr.TrimFilterFactory" 
> />
>                               </analyzer>
>                </fieldType>
>
>                <field name="collectionName" type="lowerCaseSort" 
> indexed="true" stored="true" multiValued="false" required="true" 
> omitNorms="true" />
>                <field name="hostName" type="lowerCaseSort" indexed="true" 
> stored="true" multiValued="false" required="true" omitNorms="true" />
>
> Regards,
>                Ben
>
> ------------------------------------------------------------------
> Dr Ben Ryan
> Jorum Technical Manager
>
> 5.12 Roscoe Building
> The University of Manchester
> Oxford Road
> Manchester
> M13 9PL
> Tel: 0160 275 6039
> E-mail: 
> benjamin.r...@manchester.ac.uk<https://outlook.manchester.ac.uk/owa/redir.aspx?C=b28b5bdd1a91425abf8e32748c93f487&URL=mailto%3abenjamin.ryan%40manchester.ac.uk>
> ------------------------------------------------------------------
>

Reply via email to