Return-Path: X-Original-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Delivered-To: apmail-lucene-lucene-net-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2ED586C45 for ; Mon, 30 May 2011 18:32:34 +0000 (UTC) Received: (qmail 71757 invoked by uid 500); 30 May 2011 18:32:34 -0000 Delivered-To: apmail-lucene-lucene-net-commits-archive@lucene.apache.org Received: (qmail 71727 invoked by uid 500); 30 May 2011 18:32:34 -0000 Mailing-List: contact lucene-net-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucene.apache.org Delivered-To: mailing list lucene-net-commits@lucene.apache.org Received: (qmail 71720 invoked by uid 99); 30 May 2011 18:32:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 18:32:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 18:32:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D4967238896F; Mon, 30 May 2011 18:32:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Mon, 30 May 2011 18:32:12 -0000 To: lucene-net-commits@lucene.apache.org From: digy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110530183212.D4967238896F@eris.apache.org> Subject: [Lucene.Net] svn commit: r1129283 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g: src/contrib/SimpleFacetedSearch/Hits.cs test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs Author: digy Date: Mon May 30 18:32:12 2011 New Revision: 1129283 URL: http://svn.apache.org/viewvc?rev=1129283&view=rev Log: [LUCENENET-415] Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SimpleFacetedSearch/Hits.cs incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SimpleFacetedSearch/Hits.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SimpleFacetedSearch/Hits.cs?rev=1129283&r1=1129282&r2=1129283&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SimpleFacetedSearch/Hits.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/SimpleFacetedSearch/Hits.cs Mon May 30 18:32:12 2011 @@ -28,6 +28,17 @@ namespace Lucene.Net.Search { long _TotalHitCount = -1; HitsPerFacet[] _HitsPerGroup; + Dictionary _Indexer = new Dictionary(); + + public HitsPerFacet this[string name] + { + get{ return _Indexer[name];} + } + + public HitsPerFacet this[FacetName name] + { + get { return _Indexer[name.ToString()]; } + } public long TotalHitCount { @@ -48,7 +59,14 @@ namespace Lucene.Net.Search public HitsPerFacet[] HitsPerFacet { get { return _HitsPerGroup; } - internal set { _HitsPerGroup = value; } + internal set + { + _HitsPerGroup = value; + foreach (var h in _HitsPerGroup) + { + _Indexer.Add(h.Name.ToString(), h); + } + } } } } Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs?rev=1129283&r1=1129282&r2=1129283&view=diff ============================================================================== --- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs (original) +++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs Mon May 30 18:32:12 2011 @@ -138,6 +138,10 @@ namespace Lucene.Net.Search foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet) { + //Test for [System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary.] + var x = hits[hpg.Name]; + var y = hits[hpg.Name.ToString()]; + if (hpg.Name[0] == "us" && hpg.Name[1] == "CCN" && hpg.Name[2] == "politics") { Assert.AreEqual(1, hpg.HitCount);