Changeset 4403

Show
Ignore:
Timestamp:
Fri Jan 27 15:48:22 2006
Author:
mugur
Message:

fixed ticket:1677 - Make better decisions when building the search article list

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/campsite/implementation/parser/parser/actions.cpp

    r4393 r4403  
    673 673         CheckFor("NrIssue", c.Issue(), buf, w);  
    674 674     buf.str("");  
    675       buf << "IdLanguage = " << c.Language();// << " or IdLanguage = 1)";  
      675     buf << "IdLanguage = " << c.Language();  
    675 675     if (w != "")  
    676 676         w += " and ";  
     
    783 783     CheckFor("NrSection", c.Section(), buf, w);  
    784 784     buf.str("");  
    785       buf << "Articles.IdLanguage = " << c.Language();// << " or Articles.IdLanguage = 1)";  
      785     buf << "Articles.IdLanguage = " << c.Language();  
    785 785     if (w != "")  
    786 786         w += " and ";  
     
    869 869         w += " and ";  
    870 870     w += "ArticleIndex.IdKeyword = KeywordIndex.Id"  
    871            " and Articles.Number = ArticleIndex.NrArticle"  
    872            " and Articles.IdPublication = ArticleIndex.IdPublication"  
    873            " and Articles.IdLanguage = ArticleIndex.IdLanguage"  
    874            " and Articles.NrIssue = ArticleIndex.NrIssue"  
    875            " and Articles.NrSection = ArticleIndex.NrSection";  
      871             " and Articles.Number = ArticleIndex.NrArticle"  
      872             " and Articles.IdPublication = ArticleIndex.IdPublication"  
      873             " and Articles.IdLanguage = ArticleIndex.IdLanguage"  
      874             " and Articles.NrIssue = ArticleIndex.NrIssue"  
      875             " and Articles.NrSection = ArticleIndex.NrSection";  
    876 876     s = string(" where ") + w;  
    877 877     return RES_OK;  
     
    1062 1062         WriteLimit(limit, lc);  
    1063 1063          
      1064         string coLanguageId;  
    1064 1065         switch (modifier) {  
    1065 1066             case CMS_ST_ISSUE:  
    1066 1067             case CMS_ST_SECTION:  
    1067                   fields = "select Number, MAX(IdLanguage), IdPublication";  
      1068                 fields = "select Number, IdLanguage, IdPublication";  
    1067 1068                 if (modifier == CMS_ST_SECTION)  
    1068 1069                     fields += ", NrIssue";  
    1069 1070                 break;  
    1070 1071             case CMS_ST_ARTICLE:  
    1071                   fields = "select Number, MAX(Articles.IdLanguage), IdPublication"  
      1072                 fields = "select Number, Articles.IdLanguage, IdPublication"  
    1071 1072                         ", Articles.NrIssue, Articles.NrSection";  
    1072 1073                 break;  
    1073 1074             case CMS_ST_SEARCHRESULT:  
    1074                   fields = "select NrArticle, MAX(Articles.IdLanguage), Articles.IdPublication"  
    1075                           ", Articles.NrIssue, Articles.NrSection";  
      1075                 coLanguageId = (string)Integer(c.Language());  
      1076                 fields = "select NrArticle, " + coLanguageId +  ", Articles.IdPublication, "  
      1077                         "Articles.NrIssue, Articles.NrSection, MIN(ABS(Articles.IdLanguage - "  
      1078                         + coLanguageId + ")), MIN(Articles.IdLanguage - 1)";  
    1076 1079                 break;  
    1077 1080             case CMS_ST_ARTICLETOPIC:  
    1137 1140                          || modifier == CMS_ST_ARTICLE || modifier == CMS_ST_SEARCHRESULT)  
    1138 1141             {  
    1139                   lc.SetLanguage(strtol(row[1], 0, 10));  
      1142                 if (modifier != CMS_ST_SEARCHRESULT)  
      1143                 {  
      1144                     lc.SetLanguage(strtol(row[1], 0, 10));  
      1145                 }  
      1146                 else  
      1147                 {  
      1148                     Integer coCurrentLangDiff(row[5]);  
      1149                     Integer coEnglishDiff(row[6]);  
      1150                     if ((lint)coCurrentLangDiff == 0)  
      1151                     {  
      1152                         lc.SetLanguage(strtol(row[1], 0, 10));  
      1153                     }  
      1154                     else  
      1155                     {  
      1156                         lc.SetLanguage(1 + (lint)coEnglishDiff);  
      1157                     }  
      1158                 }  
    1140 1159                 lc.SetPublication(strtol(row[2], 0, 10));  
    1141 1160                 if (modifier != CMS_ST_ISSUE)