lux/dist/result.h

00001 #ifndef LUX_DIST_RESULT_H
00002 #define LUX_DIST_RESULT_H
00003 
00004 #include "lux/lux.h"
00005 #include "lux/api/paging.h"
00006 #include <vector>
00007 
00008 namespace Lux {
00009 namespace Dist {
00010 
00014   struct MergeResult {
00015     // [TODO] need cluster_id ?
00016     uint32_t server_id;
00017     doc_id_t doc_id;
00018     score_t score;
00019     char *attr;
00020   };
00021   typedef std::vector<MergeResult> MergeResultSet;
00022 
00023   static inline
00024   void clear_mrs(MergeResultSet &mrs)
00025   {
00026     MergeResultSet::iterator itr_end = mrs.end();
00027     for (MergeResultSet::iterator itr = mrs.begin();
00028          itr != itr_end; ++itr) {
00029       delete [] itr->attr;
00030     }
00031   }
00032 
00036   struct DocResult {
00037     DocResult(doc_id_t _id, std::string &_data)
00038     : id(_id), data(_data)
00039     {}
00040 
00041     doc_id_t id;
00042     std::string data;
00043   };
00044   typedef std::vector<DocResult> DocResultSet;
00045 
00049   struct ClusterResult {
00050     ClusterResult(std::string &_doc, score_t _score)
00051     : doc(_doc), score(_score)
00052     {}
00053 
00054     std::string doc; // serialized by DocumentSerializer
00055     score_t score; // set 0 when sorted by an attribute
00056   };
00057   typedef std::vector<ClusterResult> ClusterResultSet;
00058 
00062   struct TmpResultSet {
00063     TmpResultSet(void)
00064     {}
00065 
00066     TmpResultSet(Paging &_paging,
00067                  ClusterResultSet &_crs, uint32_t _total_doc_size)
00068     : paging(_paging), crs(_crs), total_doc_size(_total_doc_size)
00069     {}
00070 
00071     Paging paging;
00072     ClusterResultSet crs;
00073     uint32_t total_doc_size;
00074   };
00075 
00076 }
00077 }
00078 
00079 #endif

Generated on Fri Feb 5 15:50:30 2010 for Lux by  doxygen 1.4.7