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.147 2008-09-30 12:38:29 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.148 2008-10-07 06:44:23 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
...
...
707
// Try to translate field specification into field prefix.  We have a
707
// Try to translate field specification into field prefix.  We have a
708
// default table used if translations are not in the config for some
708
// default table used if translations are not in the config for some
709
// reason (old config not updated ?). We use it only if the config
709
// reason (old config not updated ?). We use it only if the config
710
// translation fails. Also we add in there fields which should be
710
// translation fails. Also we add in there fields which should be
711
// indexed with no prefix (ie: abstract)
711
// indexed with no prefix (ie: abstract)
712
bool Db::fieldToPrefix(const string& fldname, string &pfx)
712
bool Db::fieldToPrefix(const string& fld, string &pfx)
713
{
713
{
714
    // This is the default table. We prefer the data from rclconfig if 
714
    // This is the default table. We prefer the data from rclconfig if 
715
    // available
715
    // available
716
    static map<string, string> fldToPrefs;
716
    static map<string, string> fldToPrefs;
717
    if (fldToPrefs.empty()) {
717
    if (fldToPrefs.empty()) {
...
...
730
    fldToPrefs[Doc::keykw] = "K";
730
    fldToPrefs[Doc::keykw] = "K";
731
    fldToPrefs["keyword"] = "K";
731
    fldToPrefs["keyword"] = "K";
732
    fldToPrefs["tag"] = "K";
732
    fldToPrefs["tag"] = "K";
733
    fldToPrefs["tags"] = "K";
733
    fldToPrefs["tags"] = "K";
734
    }
734
    }
735
736
    string fld(fldname);
737
    stringtolower(fld);
738
735
739
    RclConfig *config = RclConfig::getMainConfig();
736
    RclConfig *config = RclConfig::getMainConfig();
740
    if (config && config->getFieldPrefix(fld, pfx))
737
    if (config && config->getFieldPrefix(fld, pfx))
741
    return true;
738
    return true;
742
739
...
...
1049
    RclConfig *config = RclConfig::getMainConfig();
1046
    RclConfig *config = RclConfig::getMainConfig();
1050
    if (config) {
1047
    if (config) {
1051
    const set<string>& stored = config->getStoredFields();
1048
    const set<string>& stored = config->getStoredFields();
1052
    for (set<string>::const_iterator it = stored.begin();
1049
    for (set<string>::const_iterator it = stored.begin();
1053
         it != stored.end(); it++) {
1050
         it != stored.end(); it++) {
1054
        string nm = stringtolower(config->fieldCanon(*it));
1051
        string nm = config->fieldCanon(*it);
1055
        if (!doc.meta[*it].empty()) {
1052
        if (!doc.meta[*it].empty()) {
1056
        string value = 
1053
        string value = 
1057
            neutchars(truncate_to_word(doc.meta[*it], 150), nc);
1054
            neutchars(truncate_to_word(doc.meta[*it], 150), nc);
1058
        RECORD_APPEND(record, nm, value);
1055
        RECORD_APPEND(record, nm, value);
1059
        }
1056
        }