22 SharedPtr<SphinxResultData>& sphinxResultData)
26 vector<pair<string, unsigned long long> > weightKeyPairs;
31 trancateByWeight(weightKeyPairs, sphinxResultData);
35 SphinxResultSorterIf& SphinxResultTruncater::selectResultSorter(SharedPtr<SphinxResultData>& sphinxResultData)
37 unsigned int sortMode = 0;
38 if (sphinxResultData->getRequestInfoCount() > 0){
39 sortMode = sphinxResultData->getRequestInfoItem(0).getOrderBy();
43 return _sphinxResultAscSorter;
46 return _sphinxResultDescSorter;
48 return _sphinxResultNullSorter;
52 void SphinxResultTruncater::trancateByWeight
53 (vector<pair<string, unsigned long long> >& sortedWeightDocIds,
54 SharedPtr<SphinxResultData>& sphinxResultData)
56 unsigned int maxNumberToSave = 0;
57 if (sphinxResultData->getRequestInfoCount() > 0){
58 maxNumberToSave = sphinxResultData->getRequestInfoItem(0).getMaxResultsNumber();
60 if (sortedWeightDocIds.size() > maxNumberToSave){
61 sortedWeightDocIds.erase(sortedWeightDocIds.begin() + maxNumberToSave,
62 sortedWeightDocIds.end());