Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 813ED200828 for ; Fri, 13 May 2016 17:37:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7FB4716099F; Fri, 13 May 2016 15:37:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C54D41602BE for ; Fri, 13 May 2016 17:37:19 +0200 (CEST) Received: (qmail 95730 invoked by uid 500); 13 May 2016 15:37:18 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 95718 invoked by uid 99); 13 May 2016 15:37:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 May 2016 15:37:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 71FADC1DD7 for ; Fri, 13 May 2016 15:37:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.299 X-Spam-Level: ** X-Spam-Status: No, score=2.299 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, KAM_LIVE=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=johnbickerstaff-com.20150623.gappssmtp.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id tkWi7itRFZV8 for ; Fri, 13 May 2016 15:37:15 +0000 (UTC) Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 0B6B45F19D for ; Fri, 13 May 2016 15:37:07 +0000 (UTC) Received: by mail-pf0-f178.google.com with SMTP id c189so45114782pfb.3 for ; Fri, 13 May 2016 08:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnbickerstaff-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=qmwbeTVuf7TDWGzobWiAL0F6O70PgCH6TZGvo/hcvMY=; b=CORmiTwuEsJ5tHqm1vZypkOdKaYH3j1pQx4DVfKb6c5sQkM4CrRFo64ycokptotdug Brz9NYNGAI2akF+jpyDpR7NfEbdzbzDC3USkNKQHULxJCxG4QWWefBd8tyIqfusz7vzG dV8wDxgKkpbOCix2IXm8eJqCdJ+IqpDNagq/icpWjhTqKwi+Mt3XvARt6yZQsNKbnSwi QZJKJODvxzyteqLipIgEVCVD/mKqvKrsuAct5PAY4Hvttk4KP4U/APCpIOEiUEYH3Xmi lElBjsg2C5yamKKv6vw0PEuTh3+y97ik3a+ba8ly7gs9M/+bcZLeaBk10nriruTqDCDA L0iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=qmwbeTVuf7TDWGzobWiAL0F6O70PgCH6TZGvo/hcvMY=; b=G3n4Qv0C+6amnxvXVNKMZ3fgdePD9sYnY8+ofwmTPsMoapo6z0meqJ5gNsBKoHGA3s Dne2m7SIJRrvenBWXOo0jAXIeCN7VUT7ymw4FkmXg64WMVnJlsA1M4oZJPxf2ygd6oIG 34kNVhVuv6lyUen4cbOMDNlq5gR+4Xz3mF+tylx8MGhsexa83lI1xnHvWPX53niTgySF uRxxLOEoVn1V+iGoCBLlm4hpw3HAgtcAJfXDPS4DTIXL3b3xozUrRrEEIt+PVLr33U0K 4hG97yjcyvdbtJ9JqXb0puMQ4JhwkWQwb8xcpef5zvxd5nS8k1Ea43a3SbcJUsfVVTvg 1tig== X-Gm-Message-State: AOPr4FW9WKc3emUmNVeM9tlOAvoJD85Ik3xDh6DToot4ac16Xu1Du3uy99AgD94bMPD3zcirOfDxpbH7rW5isg== MIME-Version: 1.0 X-Received: by 10.98.2.14 with SMTP id 14mr24201699pfc.148.1463153819942; Fri, 13 May 2016 08:36:59 -0700 (PDT) Received: by 10.66.230.131 with HTTP; Fri, 13 May 2016 08:36:59 -0700 (PDT) In-Reply-To: References: <070b9715-f4c3-7e16-8f93-30bde983c0ea@elyograg.org> Date: Fri, 13 May 2016 09:36:59 -0600 Message-ID: Subject: Re: Is there an equivalent to an SQL "select distinct" in Solr From: John Bickerstaff To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a11439e6ab0c9430532bb0b70 archived-at: Fri, 13 May 2016 15:37:20 -0000 --001a11439e6ab0c9430532bb0b70 Content-Type: text/plain; charset=UTF-8 In case it's helpful for a quick and dirty peek at your facets, the following URL (in a browser or Curl) will get you basic facets for a field named "category" -- assuming you change the IP address / hostname to match yours. http:/XXX.XXX.XX.XX:8983/solr/statdx_shard1_replica3/select q=*%3A*&rows=0&wt=json&indent=true&facet=true&facet.field=category You can also do this in the Admin UI by checking the "facet" box, and entering the field name in the facet.field that pops up. You can leave the query field at the default *:* You need to make sure that you put a "0" in the rows field as well (right under "sort") in order to just get back the facet counts. On Fri, May 13, 2016 at 7:52 AM, Joel Bernstein wrote: > You may also want to try out the SQL interface in Solr 6.0 which supports > SELECT DISTINCT queries. > > > https://cwiki.apache.org/confluence/display/solr/Parallel+SQL+Interface#ParallelSQLInterface-SELECTDISTINCTQueries > > Joel Bernstein > http://joelsolr.blogspot.com/ > > On Fri, May 13, 2016 at 9:47 AM, GW wrote: > > > Thank you Shawn, > > > > I will toy with these over the weekend. Solr/Hadoop/Hbase has been a > nasty > > learning curve for me, > > It would probably would have been a lot easier if I didn't have 30 years > of > > RDBMS stuck in my head. > > > > Again, > > > > Many thanks for your response. > > > > > > On 13 May 2016 at 08:57, Shawn Heisey wrote: > > > > > On 5/13/2016 6:48 AM, GW wrote: > > > > Let's say I have 10,000 documents and there is a field named > "category" > > > and > > > > lets say there are 200 categories but I do not know what they are. > > > > > > > > My question: Is there a query/filter that can pull a list of distinct > > > > categories? > > > > > > Sounds like a job for faceting or grouping. Which one of them to use > > > will depend on exactly what you're trying to obtain in your results. > > > > > > https://cwiki.apache.org/confluence/display/solr/Faceting > > > https://cwiki.apache.org/confluence/display/solr/Result+Grouping > > > > > > Thanks, > > > Shawn > > > > > > > > > --001a11439e6ab0c9430532bb0b70--