searchengine/cpix/cpix/src/common/gpssort.cpp
changeset 15 cf5c74390b98
parent 0 671dee74050a
equal deleted inserted replaced
10:afe194b6b1cd 15:cf5c74390b98
   420         locations.clear();
   420         locations.clear();
   421         locations.reserve(count);
   421         locations.reserve(count);
   422 
   422 
   423         for (int32_t i = 0; i < count; ++i)
   423         for (int32_t i = 0; i < count; ++i)
   424             {
   424             {
   425                 cpix_Document
   425                 cpix_Document* cpixDoc = new cpix_Document;
   426                     cpixDoc;
       
   427 
   426 
   428                 cpix_Hits_doc(unsortedHits,
   427                 cpix_Hits_doc(unsortedHits,
   429                               i, 
   428                               i, 
   430                               &cpixDoc);
   429                               &cpixDoc,
       
   430                               1);
   431                 
   431                 
   432                 float
   432                 float
   433                     gpsLat,
   433                     gpsLat,
   434                     gpsLong;
   434                     gpsLong;
   435 
   435 
   436                 auto_ptr<lucene::document::Document>
   436                 auto_ptr<lucene::document::Document>
   437                     clone(cloneAndGetGps(&Cast2Native<cpix_Document>(&cpixDoc)->native(),
   437                     clone(cloneAndGetGps(&Cast2Native<cpix_Document>(cpixDoc)->native(),
   438                                          &gpsLat,
   438                                          &gpsLat,
   439                                          &gpsLong));
   439                                          &gpsLong));
   440                 GpsDistance
   440                 GpsDistance
   441                     gdp(clone.get(),
   441                     gdp(clone.get(),
   442                         gpsLat,
   442                         gpsLat,
   445                 // GpsDistance instance pointed by gdp took ownership
   445                 // GpsDistance instance pointed by gdp took ownership
   446                 // of document pointed by cloce
   446                 // of document pointed by cloce
   447                 clone.release();
   447                 clone.release();
   448 
   448 
   449                 locations.push_back(gdp);
   449                 locations.push_back(gdp);
       
   450                 
       
   451                 delete cpixDoc;
   450             }
   452             }
   451     }
   453     }
   452 }
   454 }
   453 
   455 
   454 
   456