Switch to unified view

a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.16 2007-06-19 08:36:24 dockes Exp $ (C) 2006 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: searchdata.cpp,v 1.17 2007-06-22 06:14:04 dockes Exp $ (C) 2006 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
70
    xq = xq.empty() ? nq : Xapian::Query(op, xq, nq);
70
    xq = xq.empty() ? nq : Xapian::Query(op, xq, nq);
71
    }
71
    }
72
72
73
    // Add the file type filtering clause if any
73
    // Add the file type filtering clause if any
74
    if (!m_filetypes.empty()) {
74
    if (!m_filetypes.empty()) {
75
  vector<string> exptps;
76
  exptps.reserve(m_filetypes.size());
77
  // Expand categories
78
  RclConfig *cfg = RclConfig::getMainConfig();
79
  for (vector<string>::iterator it = m_filetypes.begin(); 
80
       it != m_filetypes.end(); it++) {
81
      if (cfg && cfg->isMimeCategory(*it)) {
82
      list<string>tps;
83
      cfg->getMimeCatTypes(*it, tps);
84
      exptps.insert(exptps.end(), tps.begin(), tps.end());
85
      } else {
86
      exptps.push_back(*it);
87
      }
88
  }
89
      
75
    list<Xapian::Query> pqueries;
90
    list<Xapian::Query> pqueries;
76
    Xapian::Query tq;
91
    Xapian::Query tq;
77
    for (vector<string>::iterator it = m_filetypes.begin(); 
92
    for (vector<string>::iterator it = exptps.begin(); 
78
         it != m_filetypes.end(); it++) {
93
         it != exptps.end(); it++) {
79
        string term = "T" + *it;
94
        string term = "T" + *it;
80
        LOGDEB(("Adding file type term: [%s]\n", term.c_str()));
95
        LOGDEB(("Adding file type term: [%s]\n", term.c_str()));
81
        tq = tq.empty() ? Xapian::Query(term) : 
96
        tq = tq.empty() ? Xapian::Query(term) : 
82
        Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));
97
        Xapian::Query(Xapian::Query::OP_OR, tq, Xapian::Query(term));
83
    }
98
    }