searchengine/cpix/cpix/src/cpixsearch.cpp
changeset 14 8bd192d47aaa
parent 8 6547bf8ca13a
--- a/searchengine/cpix/cpix/src/cpixsearch.cpp	Mon Jul 26 12:27:31 2010 +0530
+++ b/searchengine/cpix/cpix/src/cpixsearch.cpp	Mon Aug 09 10:51:30 2010 +0530
@@ -235,25 +235,36 @@
 
 void cpix_Hits_doc(cpix_Hits     * thisHits,
                    int32_t         index,
-                   cpix_Document * target)
+                   cpix_Document ** target,
+                   int32_t         count ) 
 {
-    Cpix::Document
-        * pDoc = XlateExc(thisHits,
+
+    int result = XlateExc(thisHits,
                           Caller(thisHits,
-                                     &Cpix::IHits::getDocument,
-                                     index));
-    if (cpix_Succeeded(thisHits))
-    {
-    	target->ptr_ = pDoc;
-        target->err_ = NULL;
-
-        // TEMP (?) post-condition code
-        if (target->ptr_ == NULL)
-            {
-                thisHits->err_
-                    = CreateError(ET_CPIX_EXC,
-                                  L"PANIC PANIC PANIC - NULL doc returned without any error message!");
-            }
+                                     &Cpix::IHits::resetDocumentCache,
+                                     index,
+                                     count));
+    
+    for (int32_t i = 0; i < count && i < result ; i++) {
+        Cpix::Document
+            * pDoc = XlateExc(thisHits,
+                              Caller(thisHits,
+                                         &Cpix::IHits::getDocument,
+                                         index++));
+        if (cpix_Succeeded(thisHits))
+        {
+            target[i]->ptr_ = pDoc;
+            target[i]->err_ = NULL;
+    
+            // TEMP (?) post-condition code
+            if (target[i]->ptr_ == NULL)
+                {
+                    thisHits->err_
+                        = CreateError(ET_CPIX_EXC,
+                                      L"PANIC PANIC PANIC - NULL doc returned without any error message!");
+                }
+            //target ++;
+        }
     }
 }