From java-user-return-51351-apmail-lucene-java-user-archive=lucene.apache.org@lucene.apache.org Wed Nov 23 01:16:34 2011 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 7F0D39DDC for ; Wed, 23 Nov 2011 01:16:34 +0000 (UTC) Received: (qmail 72537 invoked by uid 500); 23 Nov 2011 01:16:32 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 72490 invoked by uid 500); 23 Nov 2011 01:16:32 -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 72482 invoked by uid 99); 23 Nov 2011 01:16:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 01:16:32 +0000 X-ASF-Spam-Status: No, hits=4.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,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 felipe.carvalho@gmail.com designates 209.85.161.176 as permitted sender) Received: from [209.85.161.176] (HELO mail-gx0-f176.google.com) (209.85.161.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 01:16:26 +0000 Received: by ggnv2 with SMTP id v2so829549ggn.35 for ; Tue, 22 Nov 2011 17:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=UpXoo8DgO6zppf0Yz9pdww88klleOHFIoPvLR5TCz3A=; b=GX1LVEhqAlcs9QHfuvJQZf1rKE9q/lT/JVLqaXmTtdsJHdPc+RsH4YVq4ql5CmRNrx 7oaOucBMFtf8k37UTZEl/OgLi1abMOFpRDdXw1EzOMoRAN7pKUAaKPd08zRxhaIAwfMB l9c0dhEwzB4yJTJlsScCU6Kz7Gz0MAUp74f2w= Received: by 10.182.150.4 with SMTP id ue4mr8019007obb.74.1322010965081; Tue, 22 Nov 2011 17:16:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.39.3 with HTTP; Tue, 22 Nov 2011 17:15:44 -0800 (PST) In-Reply-To: References: <1228b5ce.6b65.133c43065b3.Coremail.liugangc@gmail.com> From: Felipe Carvalho Date: Tue, 22 Nov 2011 23:15:44 -0200 Message-ID: Subject: Re: Filtering search results To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=f46d04479685f6800b04b25ca999 --f46d04479685f6800b04b25ca999 Content-Type: text/plain; charset=ISO-8859-1 I'd really love to use Solr, but unfortunately this is not an option for this project I'm working on, Would anybody have a pointer to an article or a few lines of code showing how to use this using Lucene core? I've done quite some digging on Google, but I could only people suggesting to use Solr instead. Thanks for any help anyone may give. On Mon, Nov 21, 2011 at 12:25 PM, Erick Erickson wrote: > http://wiki.apache.org/solr/FieldCollapsing > > On Mon, Nov 21, 2011 at 8:17 AM, Felipe Carvalho > wrote: > > Thanks for the tip, Erick! Any pointer to any article showing how to use > it? > > > > Thanks > > > > On Mon, Nov 21http://wiki.apache.org/solr/FieldCollapsing, 2011 at > 10:49 AM, Erick Erickson wrote: > > > >> 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. Faceting 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 better way to > solve > >> your problem. > >> >> > >> >> -- > >> >> gang liu > >> >> email: liugangc@gmail.com > >> >> > >> >> > >> >> > >> >> At 2011-11-21 09:35:08,"Felipe Carvalho" > >> wrote: > >> >>>Hello, > >> >>> I'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. > >> >>> When I run a "name" search over these documents, I need to render > two > >> >>>lists: employees that match the search criteria and consultants that > >> match > >> >>>the criteria. > >> >>> I'm running Lucene 3.4, is there a way for Lucene to hand me over > >> those > >> >>>lists of documents separately on the same query? > >> >>> Currently I run the query and then loop through the results, > >> separating > >> >>>employees and consultants in two lists, is there a better way to do > >> this? > >> >>> A heard a colleague saying Solr supports this through "faceted > search" > >> >>>(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 > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --f46d04479685f6800b04b25ca999--