let rclconfig take care of field name lowercasing

This commit is contained in:
dockes
2008-10-07 06:44:23 +00:00
parent 0a04919f5a
commit b932263533
6 changed files with 2391 additions and 3207 deletions
+3 -6
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.147 2008-09-30 12:38:29 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.148 2008-10-07 06:44:23 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -709,7 +709,7 @@ bool Db::isopen()
// reason (old config not updated ?). We use it only if the config
// translation fails. Also we add in there fields which should be
// indexed with no prefix (ie: abstract)
bool Db::fieldToPrefix(const string& fldname, string &pfx)
bool Db::fieldToPrefix(const string& fld, string &pfx)
{
// This is the default table. We prefer the data from rclconfig if
// available
@@ -733,9 +733,6 @@ bool Db::fieldToPrefix(const string& fldname, string &pfx)
fldToPrefs["tags"] = "K";
}
string fld(fldname);
stringtolower(fld);
RclConfig *config = RclConfig::getMainConfig();
if (config && config->getFieldPrefix(fld, pfx))
return true;
@@ -1051,7 +1048,7 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi,
const set<string>& stored = config->getStoredFields();
for (set<string>::const_iterator it = stored.begin();
it != stored.end(); it++) {
string nm = stringtolower(config->fieldCanon(*it));
string nm = config->fieldCanon(*it);
if (!doc.meta[*it].empty()) {
string value =
neutchars(truncate_to_word(doc.meta[*it], 150), nc);
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.9 2008-09-29 11:33:55 dockes Exp $ (C) 2008 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclquery.cpp,v 1.10 2008-10-07 06:44:23 dockes Exp $ (C) 2008 J.F.Dockes";
#endif
#include <stdlib.h>
@@ -114,7 +114,7 @@ Db *Query::whatDb()
void Query::setSortBy(const string& fld, bool ascending) {
RclConfig *cfg = RclConfig::getMainConfig();
m_sortField = cfg->fieldCanon(stringtolower(fld));
m_sortField = cfg->fieldCanon(fld);
m_sortAscending = ascending;
LOGDEB0(("RclQuery::setSortBy: [%s] %s\n", m_sortField.c_str(),
m_sortAscending ? "ascending" : "descending"));