lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1128894 - /incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs
Date Sun, 29 May 2011 15:47:49 GMT
Author: digy
Date: Sun May 29 15:47:49 2011
New Revision: 1128894

URL: http://svn.apache.org/viewvc?rev=1128894&view=rev
Log:
[LUCENENET-415]
* max-facet-count check added (default 2048)
* multi-threaded calculation of facets added
* HitCount is not a performance killer anymore(due to multithreading)

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/contrib/SimpleFacetedSearch/TestSimpleFacetedSearch.cs

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=1128894&r1=1128893&r2=1128894&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
Sun May 29 15:47:49 2011
@@ -88,9 +88,9 @@ namespace Lucene.Net.Search
             SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, "category");
             SimpleFacetedSearch.Hits hits = sfs.Search(query);
 
-            Assert.AreEqual(4, hits.HitsPerGroup.Length);
+            Assert.AreEqual(4, hits.HitsPerFacet.Length);
 
-            foreach (SimpleFacetedSearch.HitsPerGroup hpg in hits.HitsPerGroup)
+            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
             {
                 if (hpg.Name[0] == "politics")
                 {
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search
 
             Assert.AreEqual(4, hits.TotalHitCount);
 
-            foreach (SimpleFacetedSearch.HitsPerGroup hpg in hits.HitsPerGroup)
+            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
             {
                 foreach (Document doc in hpg.Documents)
                 {
@@ -132,10 +132,10 @@ namespace Lucene.Net.Search
             SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, new string[] { "lang",
"source", "category" });
             SimpleFacetedSearch.Hits hits = sfs.Search(query);
 
-            Assert.AreEqual(6, hits.HitsPerGroup.Length);
+            Assert.AreEqual(6, hits.HitsPerFacet.Length);
             int nohit = 0;
 
-            foreach (SimpleFacetedSearch.HitsPerGroup hpg in hits.HitsPerGroup)
+            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
             {
                 if (hpg.Name[0] == "us" && hpg.Name[1] == "CCN" && hpg.Name[2]
== "politics")
                 {
@@ -165,7 +165,7 @@ namespace Lucene.Net.Search
             Assert.AreEqual(2, nohit);
             Assert.AreEqual(4, hits.TotalHitCount);
 
-            foreach (SimpleFacetedSearch.HitsPerGroup hpg in hits.HitsPerGroup)
+            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
             {
                 foreach (Document doc in hpg.Documents)
                 {
@@ -183,10 +183,10 @@ namespace Lucene.Net.Search
             SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, "category");
             SimpleFacetedSearch.Hits hits = sfs.Search(query);
 
-            Assert.AreEqual(4, hits.HitsPerGroup.Length);
-            Assert.AreEqual(0, hits.HitsPerGroup[0].HitCount);
-            Assert.AreEqual(0, hits.HitsPerGroup[1].HitCount);
-            Assert.AreEqual(0, hits.HitsPerGroup[2].HitCount);
+            Assert.AreEqual(4, hits.HitsPerFacet.Length);
+            Assert.AreEqual(0, hits.HitsPerFacet[0].HitCount);
+            Assert.AreEqual(0, hits.HitsPerFacet[1].HitCount);
+            Assert.AreEqual(0, hits.HitsPerFacet[2].HitCount);
         }
 
         [Test]
@@ -209,7 +209,7 @@ namespace Lucene.Net.Search
             SimpleFacetedSearch.Hits hits = sfs.Search(query);
 
             Assert.AreEqual(0, hits.TotalHitCount);
-            Assert.AreEqual(0, hits.HitsPerGroup.Length);
+            Assert.AreEqual(0, hits.HitsPerFacet.Length);
         }
 
         /// <summary>
@@ -224,17 +224,19 @@ namespace Lucene.Net.Search
             SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, new string[] { "source",
"category" });
             SimpleFacetedSearch.Hits hits = sfs.Search(query, 10);
 
-            //If you need performance, don't invoke "TotalHitCount"
             long totalHits = hits.TotalHitCount;
-            foreach (SimpleFacetedSearch.HitsPerGroup hpg in hits.HitsPerGroup)
+            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
             {
-                //If you need performance, don't invoke "HitCount"
                 long hitCountPerGroup = hpg.HitCount;
-                SimpleFacetedSearch.GroupName groupName = hpg.Name;
+                SimpleFacetedSearch.FacetName facetName = hpg.Name;
+                for (int i = 0; i < facetName.Length; i++)
+                {
+                    string part = facetName[i];
+                }
                 foreach (Document doc in hpg.Documents)
                 {
                     string text = doc.GetField("text").StringValue();
-                    System.Diagnostics.Debug.WriteLine(">>" + groupName + ": " + text);
+                    System.Diagnostics.Debug.WriteLine(">>" + facetName + ": " + text);
                 }
             }
         }



Mime
View raw message