Switch to unified view

a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.74 2006-04-30 07:44:20 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.75 2006-05-09 10:15:14 dockes Exp $ (C) 2004 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
...
...
123
    url = url.substr(7);
123
    url = url.substr(7);
124
    if (url.find(rdb->m_filterTopDir) == 0) 
124
    if (url.find(rdb->m_filterTopDir) == 0) 
125
        return true;
125
        return true;
126
    return false;
126
    return false;
127
    }
127
    }
128
129
    /// Perform stem expansion across all dbs configured for searching
130
    list<string> stemExpand(const string& lang,
131
              const string& term) 
132
    {
133
  list<string> dirs = m_extraDbs;
134
  dirs.push_front(m_basedir);
135
  list<string> exp;
136
  for (list<string>::iterator it = dirs.begin();
137
       it != dirs.end(); it++) {
138
      list<string> more = StemDb::stemExpand(*it, lang, term);
139
      LOGDEB1(("Native::stemExpand: Got %d from %s\n", 
140
          more.size(), it->c_str()));
141
      exp.splice(exp.end(), more);
142
  }
143
  exp.sort();
144
  exp.unique();
145
  LOGDEB1(("Native::stemExpand: final count %d \n", exp.size()));
146
  return exp;
147
    }
148
128
};
149
};
129
150
130
Db::Db() 
151
Db::Db() 
131
    : m_qOpts(QO_NONE)
152
    : m_qOpts(QO_NONE)
132
{
153
{
...
...
852
        list<string> exp;  
873
        list<string> exp;  
853
        string term1;
874
        string term1;
854
        dumb_string(term, term1);
875
        dumb_string(term, term1);
855
        // Possibly perform stem compression/expansion
876
        // Possibly perform stem compression/expansion
856
        if (!nostemexp && (opts & Db::QO_STEM)) {
877
        if (!nostemexp && (opts & Db::QO_STEM)) {
857
          exp = StemDb::stemExpand(m_ndb->m_basedir, stemlang,term1);
878
          exp = m_ndb->stemExpand(stemlang,term1);
858
        } else {
879
        } else {
859
            exp.push_back(term1);
880
            exp.push_back(term1);
860
        }
881
        }
861
882
862
        // Push either term or OR of stem-expanded set
883
        // Push either term or OR of stem-expanded set
...
...
1062
        break;
1083
        break;
1063
    if (lang.empty()) {
1084
    if (lang.empty()) {
1064
        res.push_back(*it);
1085
        res.push_back(*it);
1065
        ++n;
1086
        ++n;
1066
    } else {
1087
    } else {
1067
      list<string> stemexps = 
1088
      list<string> stemexps = m_ndb->stemExpand(lang, *it);
1068
      StemDb::stemExpand(m_ndb->m_basedir, lang, *it);
1069
        unsigned int cnt = 
1089
        unsigned int cnt = 
1070
        (int)stemexps.size() > max - n ? max - n : stemexps.size();
1090
        (int)stemexps.size() > max - n ? max - n : stemexps.size();
1071
        list<string>::iterator sit = stemexps.begin();
1091
        list<string>::iterator sit = stemexps.begin();
1072
        while (cnt--) {
1092
        while (cnt--) {
1073
        res.push_back(*sit++);
1093
        res.push_back(*sit++);