Switch to unified view

a/src/query/wasatorcl.cpp b/src/query/wasatorcl.cpp
...
...
59
    // instead of adding a clause. We check for these first
59
    // instead of adding a clause. We check for these first
60
    for (it = wasa->m_subs.begin(); it != wasa->m_subs.end(); it++) {
60
    for (it = wasa->m_subs.begin(); it != wasa->m_subs.end(); it++) {
61
61
62
    if (!stringicmp("mime", (*it)->m_fieldspec) ||
62
    if (!stringicmp("mime", (*it)->m_fieldspec) ||
63
        !stringicmp("format", (*it)->m_fieldspec)) {
63
        !stringicmp("format", (*it)->m_fieldspec)) {
64
        if ((*it)->m_op != WasaQuery::OP_LEAF) {
64
        if ((*it)->m_op == WasaQuery::OP_LEAF) {
65
      reason = "Negative mime/format clauses not supported yet";
66
      return 0;
67
      }
68
        sdata->addFiletype((*it)->m_value);
65
      sdata->addFiletype((*it)->m_value);
66
      } else if ((*it)->m_op == WasaQuery::OP_EXCL) {
67
      sdata->remFiletype((*it)->m_value);
68
      } else {
69
      reason = "internal error: mime clause neither leaf not excl??";
70
      return 0;
71
      }
69
        continue;
72
        continue;
70
    } 
73
    } 
71
74
72
    // Xesam uses "type", we also support "rclcat", for broad
75
    // Xesam uses "type", we also support "rclcat", for broad
73
    // categories like "audio", "presentation", etc.
76
    // categories like "audio", "presentation", etc.
74
    if (!stringicmp("rclcat", (*it)->m_fieldspec) ||
77
    if (!stringicmp("rclcat", (*it)->m_fieldspec) ||
75
        !stringicmp("type", (*it)->m_fieldspec)) {
78
        !stringicmp("type", (*it)->m_fieldspec)) {
76
        if ((*it)->m_op != WasaQuery::OP_LEAF) {
79
        if ((*it)->m_op != WasaQuery::OP_LEAF && 
77
      reason = "Negative rclcat/type clauses not supported yet";
80
      (*it)->m_op != WasaQuery::OP_EXCL) {
81
      reason = "internal error: rclcat/type clause neither leaf"
82
          "nor excl??";
78
        return 0;
83
        return 0;
79
        }
84
        }
80
        list<string> mtypes;
85
        list<string> mtypes;
81
        if (config && config->getMimeCatTypes((*it)->m_value, mtypes)
86
        if (config && config->getMimeCatTypes((*it)->m_value, mtypes)
82
        && !mtypes.empty()) {
87
        && !mtypes.empty()) {
83
        for (list<string>::iterator mit = mtypes.begin();
88
        for (list<string>::iterator mit = mtypes.begin();
84
             mit != mtypes.end(); mit++) {
89
             mit != mtypes.end(); mit++) {
90
          if ((*it)->m_op == WasaQuery::OP_LEAF)
85
            sdata->addFiletype(*mit);
91
          sdata->addFiletype(*mit);
92
          else
93
          sdata->remFiletype(*mit);
86
        }
94
        }
87
        } else {
95
        } else {
88
        reason = "Unknown rclcat/type value: no mime types found";
96
        reason = "Unknown rclcat/type value: no mime types found";
89
        return 0;
97
        return 0;
90
        }
98
        }