Thanks for that, I looked into fq and it will definatly help when I drill into zip codes.
However I'm still having some issues, facet.prefix only got me so far because sometimes the facet is the second word in the field. Also I have another question with this example: <doc> <field name="name">Company A</field> <field name="category_id">1</field> <field name="category_name">Car</field> <field name="category_alias">automobile, vehicle</field> <field name="category_id">2</field> <field name="category_name">Animals</field> <field name="category_alias">cat, dog, rat</field> </doc> Is there any way I can group category information together? So that I know the category_id for the specific category_name? For example, I want to facet search for 'vehicle' and want to count how many companies are in the mother category 1 and the name of the category = Car. I can put everything in one line and break apart with php after the fact but wondering if there is a better way. On Thu, May 29, 2008 at 5:32 PM, Yonik Seeley <[EMAIL PROTECTED]> wrote: > On Thu, May 29, 2008 at 12:22 PM, Rusli Ruslakall > <[EMAIL PROTECTED]> wrote: >> searched forever before posting and of course I found it shortly after :) >> >> Can use facet.prefix, beautiful! > > You can also constrain both results and facets to any arbitrary query > via fq=myquery > > -Yonik > > >> On Thu, May 29, 2008 at 3:43 PM, Rusli Ruslakall >> <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> I index something like this: >>> >>> <doc> >>> <field name="name">Company A</field> >>> <field name="cat">123</field> >>> <field name="cat">456</field> >>> <field name="cat">789</field> >>> </doc> >>> >>> <doc> >>> <field name="name">Company B</field> >>> <field name="cat">129</field> >>> <field name="cat">123</field> >>> <field name="cat">987</field> >>> </doc> >>> >>> So I ONLY want to display all category names starting with '12' and >>> how many companies are in each one. >>> >>> In this example it should output: >>> >>> name count >>> 123 (2) >>> 129 (1) >>> >>> >>> What I have now is: >>> http://localhost:8983/solr/select/?q=cat:12&facet=true&facet.limit=-1&facet.field=cat&facet.mincount=1 >>> >>> But with this I get all the categories which I would rather not prefer: >>> >>> name count >>> 123 (2) >>> 456 (1) <-- Rather not get this information >>> 789 (1) <-- Rather not get this information >>> 129 (1) >>> 987 (1) <-- Rather not get this information >>> >>> >>> Is there some way of achieving this in Solr? >>> >>> Thanks alot! >>> Jon >>> >> >