Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 60066 invoked from network); 5 Nov 2009 18:20:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Nov 2009 18:20:04 -0000 Received: (qmail 88639 invoked by uid 500); 5 Nov 2009 18:20:02 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 88571 invoked by uid 500); 5 Nov 2009 18:20:01 -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 88561 invoked by uid 99); 5 Nov 2009 18:20:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 18:20:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chris.lu@gmail.com designates 209.85.222.173 as permitted sender) Received: from [209.85.222.173] (HELO mail-pz0-f173.google.com) (209.85.222.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2009 18:19:51 +0000 Received: by pzk3 with SMTP id 3so150960pzk.20 for ; Thu, 05 Nov 2009 10:19:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type; bh=PAHmikgh2N7Ymt5WEIcpsFaP1rnTWAuDNsnxmEOaiSM=; b=sRW5NAq23x4holF6maaoNelZ2SFwtDJpJ1gwAsB85I5H7s1O7bZBDK1TRi3zgXG6ax L3EHNTLxZwZRZ/U3mwZbEIp9B5cTy0PVhBIWcShG7x6JrqkgDFPOr5qr51qocWTcfHhZ T2rmvq+7iXlmJgkCYFiB5qCAQKZSZYiGE2AbY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; b=Repcb66RgIrsI0vKEuoHp+QvhNsjcvuLikptpJ2dMjssW45T6CYdQTfMfgRKlB0lMB SlSTiCrrOg403+zQWEGkRn6i924ZG7XmmaoFb8GFCEg4a5tGFpzGtc1UKSTN/37S9WXk RysGAtglSo/LCm8AofLKgg+igald6zMSgD1wc= Received: by 10.114.165.18 with SMTP id n18mr5123829wae.154.1257445169783; Thu, 05 Nov 2009 10:19:29 -0800 (PST) Received: from ?10.1.1.122? (hq.compositesw.com [209.237.61.131]) by mx.google.com with ESMTPS id 20sm801600pxi.11.2009.11.05.10.19.28 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 05 Nov 2009 10:19:28 -0800 (PST) Message-ID: <4AF3172F.1090001@gmail.com> Date: Thu, 05 Nov 2009 10:19:27 -0800 From: Chris Lu User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: one to many relationship References: <8aa507280911030244y60cff933ie21a751620091079@mail.gmail.com> <8c4e68610911030303j3a3a0822nd76d50a595ac660b@mail.gmail.com> In-Reply-To: <8c4e68610911030303j3a3a0822nd76d50a595ac660b@mail.gmail.com> Content-Type: multipart/alternative; boundary="------------060906020606070408070002" X-Virus-Checked: Checked by ClamAV on apache.org --------------060906020606070408070002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Shahid, As Ian described, for one-to-many relationships, you need to flatten the relationship and store it into Documents. It's not efficient to search for Articles, and then based on the results to search for related groups. The database "good" 3NF model does not apply to Lucene for performance reason. -- Chris Lu ------------------------- Instant Scalable Full-Text Search On Any Database/Application site: http://www.dbsight.net demo: http://search.dbsight.com Lucene Database Search in 3 minutes: http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes DBSight customer, a shopping comparison site, (anonymous per request) got 2.6 Million Euro funding! Ian Lea wrote: >> Could anyone comment on how should I handle one-to-many relationship of >> domain objects in lucene? I have been searching the archive but was unable >> to find any answer. I have read about Compass but I am afraid it will also >> cost some performance penalty, any link to performance comparison will be >> really helpful. >> > > Sorry, can't give you any Compass info but from posts to this list it > appears to be fairly well used. And there is a good argument that you > shouldn't worry about performance in advance. > > >> In my application, I have two entities e.g Article and Group. One article >> can be categorized under zero or many groups. I don't need to index groups >> data but while indexing Articles, I have to store groups information (at >> least group ids) with each article, so that user can search articles in a >> particular group. >> > > Just do as you say: store the group ids with each article e.g. > > id: article1 > text: some text about something > groupid: 100 200 300 > > id: article2 > text: some other text about something else > groupid: 400 > > Then you can add a groupid: nnn clause to your query. As ever, you'll > need to make sure that you use a suitable analyzer at indexing and > search time. > > > -- > Ian. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --------------060906020606070408070002--