Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7BB4873BC for ; Mon, 21 Nov 2011 12:50:24 +0000 (UTC) Received: (qmail 65074 invoked by uid 500); 21 Nov 2011 12:50:22 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 64986 invoked by uid 500); 21 Nov 2011 12:50:22 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 64978 invoked by uid 99); 21 Nov 2011 12:50:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2011 12:50:22 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of erickerickson@gmail.com designates 209.85.220.176 as permitted sender) Received: from [209.85.220.176] (HELO mail-vx0-f176.google.com) (209.85.220.176) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2011 12:50:16 +0000 Received: by vcbfk13 with SMTP id fk13so7699478vcb.35 for ; Mon, 21 Nov 2011 04:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=YE52TEMDNxsv6QPalGRRd/P+6U+n7MalN8zz8pe0MWQ=; b=cHEiSqPl1UrVI3cR3k/1mlgeSKxyQgkfuGjCiTUgmi/IZbWMvfU3Vq5EMMJKlF4SMb KS7QHUl51KL+4vO28J5K3Etxk7D1jO3aoe+BrszbBuXSZz5FKhhS9kLyGVYdAwZM0Sg7 fdkdu0Wy/8t+YFwGZ85r3w9xrHsWMAMsYNLdk= MIME-Version: 1.0 Received: by 10.182.2.136 with SMTP id 8mr2960418obu.71.1321879794929; Mon, 21 Nov 2011 04:49:54 -0800 (PST) Received: by 10.182.182.66 with HTTP; Mon, 21 Nov 2011 04:49:54 -0800 (PST) In-Reply-To: References: <1228b5ce.6b65.133c43065b3.Coremail.liugangc@gmail.com> Date: Mon, 21 Nov 2011 07:49:54 -0500 Message-ID: Subject: Re: Filtering search results From: Erick Erickson To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You might take a look at grouping, aka field collapsing. Faceting gives you counts for various values in a field, but not a mixture of documents, whereas grouping will return you the top N members of each group which sounds like what you're after. Best Erick On Mon, Nov 21, 2011 at 5:04 AM, Ian Lea wrote: > Running two queries is fine, as is looping through the results list. > I don't think it is clear that one in necessarily "better" than the > other. =A0Faceting generally works by looping through results because > you typically don't know in advance what values will be present. > > -- > Ian, > > > 2011/11/21 liugangc : >> hi,faceted search is like group by in SQL, and also need query two time = to get two list in your situation. I think there isn't =A0better way to sol= ve your problem. >> >> -- >> gang liu >> email: liugangc@gmail.com >> >> >> >> At 2011-11-21 09:35:08,"Felipe Carvalho" wro= te: >>>Hello, >>> =A0I'm working on a people finder app over an index built of Person >>>documents. Among other attributes (name, gender, phone, ...) I have a >>>hiringType attribute, which possible values are EMPLOYEE and CONSULTANT. >>> =A0When I run a "name" search over these documents, I need to render tw= o >>>lists: employees that match the search criteria and consultants that mat= ch >>>the criteria. >>> =A0I'm running Lucene 3.4, is there a way for Lucene to hand me over th= ose >>>lists of documents separately on the same query? >>> =A0Currently I run the query and then loop through the results, separat= ing >>>employees and consultants in two lists, is there a better way to do this= ? >>> =A0A heard a colleague saying Solr supports this through "faceted searc= h" >>>(I'm not sure this is the right name), is there such thing on Lucene as >>>well? (unfortunately using Solr is not an option for this app) >>> >>>Thanks! >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org