You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2011/05/30 20:32:12 UTC
[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<string, HitsPerFacet> _Indexer = new Dictionary<string, HitsPerFacet>();
+
+ 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);