diff -r 34f2ffceb65e src/filters/rclimg --- a/src/filters/rclimg Mon May 16 09:39:11 2011 +0200 +++ b/src/filters/rclimg Mon May 16 10:22:01 2011 +0200 @@ -95,6 +95,10 @@ return $output; } + +#################################################################### +# Code for the rclexecm filter<->indexer protocol from here + # Get one line from stdin (from recollindex), exit on eof sub readlineorexit { my $s = <STDIN>; diff -r 34f2ffceb65e src/filters/rclinfo --- a/src/filters/rclinfo Mon May 16 09:39:11 2011 +0200 +++ b/src/filters/rclinfo Mon May 16 10:22:01 2011 +0200 @@ -12,6 +12,10 @@ # Prototype for the html document we're returning. Info files are # normally ascii. Set no charset, and let it be provided by the # environment if necessary +# +# Some info source docs contain charset info like: +# @documentencoding ISO-2022-JP +# But this seems to be absent from outputs. htmltemplate = ''' <html> <head> diff -r 34f2ffceb65e src/qtgui/rclmain_w.cpp --- a/src/qtgui/rclmain_w.cpp Mon May 16 09:39:11 2011 +0200 +++ b/src/qtgui/rclmain_w.cpp Mon May 16 10:22:01 2011 +0200 @@ -266,12 +266,8 @@ this, SLOT(startNativeViewer(Rcl::Doc))); connect(restable, SIGNAL(docPreviewClicked(int, Rcl::Doc, int)), this, SLOT(startPreview(int, Rcl::Doc, int))); - connect(restable, SIGNAL(docEditClicked(Rcl::Doc)), - this, SLOT(startNativeViewer(Rcl::Doc))); connect(restable, SIGNAL(docExpand(Rcl::Doc)), this, SLOT(docExpand(Rcl::Doc))); - connect(restable, SIGNAL(docEditClicked(Rcl::Doc)), - this, SLOT(startNativeViewer(Rcl::Doc))); connect(restable, SIGNAL(previewRequested(Rcl::Doc)), this, SLOT(startPreview(Rcl::Doc))); connect(restable, SIGNAL(editRequested(Rcl::Doc)), diff -r 34f2ffceb65e src/query/plaintorich.cpp --- a/src/query/plaintorich.cpp Mon May 16 09:39:11 2011 +0200 +++ b/src/query/plaintorich.cpp Mon May 16 10:22:01 2011 +0200 @@ -41,8 +41,6 @@ #include "cancelcheck.h" #include "unacpp.h" -const string PlainToRich::snull = ""; - // For debug printing static string vecStringToString(const vector<string>& t) { diff -r 34f2ffceb65e src/query/plaintorich.h --- a/src/query/plaintorich.h Mon May 16 09:39:11 2011 +0200 +++ b/src/query/plaintorich.h Mon May 16 10:22:01 2011 +0200 @@ -86,7 +86,7 @@ virtual string startChunk() {return snull;} protected: - static const string snull; + const string snull; bool m_inputhtml; // Use <br> to break plain text lines (else caller has used a <pre> tag) bool m_eolbr; diff -r 34f2ffceb65e src/rcldb/rcldb.cpp --- a/src/rcldb/rcldb.cpp Mon May 16 09:39:11 2011 +0200 +++ b/src/rcldb/rcldb.cpp Mon May 16 10:22:01 2011 +0200 @@ -83,6 +83,40 @@ // found in document) static const string rclSyntAbs("?!#@"); +// Only ONE field name inside the index data record differs from the +// Rcl::Doc ones: caption<->title, for a remnant of compatibility with +// omega +static const string keycap("caption"); + +// Default table for field->prefix translation. We prefer the data +// from rclconfig if available. Note that this is logically const +// after initialization. Can't use a static object to init this as +// the static std::string objects may not be ready +static map<string, string> fldToPrefs; +static void initFldToPrefs() +{ + fldToPrefs[Doc::keyabs] = string(); + fldToPrefs["ext"] = "XE"; + fldToPrefs[Doc::keyfn] = "XSFN"; + + fldToPrefs[keycap] = "S"; + fldToPrefs[Doc::keytt] = "S"; + fldToPrefs["subject"] = "S"; + + fldToPrefs[Doc::keyau] = "A"; + fldToPrefs["creator"] = "A"; + fldToPrefs["from"] = "A"; + + fldToPrefs[Doc::keykw] = "K"; + fldToPrefs["keyword"] = "K"; + fldToPrefs["tag"] = "K"; + fldToPrefs["tags"] = "K"; + + fldToPrefs["xapyear"] = "Y"; + fldToPrefs["xapyearmon"] = "M"; + fldToPrefs["xapdate"] = "D"; +} + // Compute the unique term used to link documents to their origin. // "Q" + external udi static inline string make_uniterm(const string& udi) @@ -131,11 +165,6 @@ } } -// Only ONE field name inside the index data record differs from the -// Rcl::Doc ones: caption<->title, for a remnant of compatibility with -// omega -static const string keycap("caption"); - // Turn data record from db into document fields bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data, Doc &doc) @@ -510,6 +539,9 @@ m_curtxtsz(0), m_flushtxtsz(0), m_occtxtsz(0), m_occFirstCheck(1), m_maxFsOccupPc(0), m_mode(Db::DbRO) { + if (!fldToPrefs.size()) + initFldToPrefs(); + m_ndb = new Native(this); if (m_config) { m_config->getConfParam("maxfsoccuppc", &m_maxFsOccupPc); @@ -759,39 +791,6 @@ // 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) - -// Default table. We prefer the data from rclconfig if available. Note -// that it is logically const after initialization. This would be -// simpler with c0xx initializer lists. -static map<string, string> fldToPrefs; -class InitFldToPrefs { -public: - InitFldToPrefs() - { - fldToPrefs[Doc::keyabs] = string(); - fldToPrefs["ext"] = "XE"; - fldToPrefs[Doc::keyfn] = "XSFN"; - - fldToPrefs[keycap] = "S"; - fldToPrefs[Doc::keytt] = "S"; - fldToPrefs["subject"] = "S"; - - fldToPrefs[Doc::keyau] = "A"; - fldToPrefs["creator"] = "A"; - fldToPrefs["from"] = "A"; - - fldToPrefs[Doc::keykw] = "K"; - fldToPrefs["keyword"] = "K"; - fldToPrefs["tag"] = "K"; - fldToPrefs["tags"] = "K"; - - fldToPrefs["xapyear"] = "Y"; - fldToPrefs["xapyearmon"] = "M"; - fldToPrefs["xapdate"] = "D"; - } -}; -static InitFldToPrefs IFTP; - bool Db::fieldToPrefix(const string& fld, string &pfx) { if (m_config && m_config->getFieldPrefix(fld, pfx)) diff -r 34f2ffceb65e src/rcldb/rcldb_p.h --- a/src/rcldb/rcldb_p.h Mon May 16 09:39:11 2011 +0200 +++ b/src/rcldb/rcldb_p.h Mon May 16 10:22:01 2011 +0200 @@ -114,20 +114,5 @@ }; -// Field names inside the index data record may differ from the rcldoc ones -// (esp.: caption / title) -inline const string& docfToDatf(const string& df) -{ - static const string keycap("caption"); - static const string keydmtime("dmtime"); - if (!df.compare(Doc::keytt)) { - return keycap; - } else if (!df.compare(Doc::keymt)) { - return keydmtime; - } else { - return df; - } -} - } #endif /* _rcldb_p_h_included_ */ diff -r 34f2ffceb65e src/rcldb/rclquery.cpp --- a/src/rcldb/rclquery.cpp Mon May 16 09:39:11 2011 +0200 +++ b/src/rcldb/rclquery.cpp Mon May 16 10:22:01 2011 +0200 @@ -39,6 +39,21 @@ namespace Rcl { #endif +// Field names inside the index data record may differ from the rcldoc ones +// (esp.: caption / title) +static const string& docfToDatf(const string& df) +{ + static const string keycap("caption"); + static const string keydmtime("dmtime"); + if (!df.compare(Doc::keytt)) { + return keycap; + } else if (!df.compare(Doc::keymt)) { + return keydmtime; + } else { + return df; + } +} + // Sort helper class class QSorter : public Xapian::Sorter { public: diff -r 34f2ffceb65e src/utils/circache.cpp --- a/src/utils/circache.cpp Mon May 16 09:39:11 2011 +0200 +++ b/src/utils/circache.cpp Mon May 16 10:22:01 2011 +0200 @@ -1104,12 +1104,12 @@ return true; } -void * -allocmem(void *cp, /* The array to grow. may be NULL */ - int sz, /* Unit size in bytes */ - int *np, /* Pointer to current allocation number */ - int min, /* Number to allocate the first time */ - int maxinc) /* Maximum increment */ +static void *allocmem( + void *cp, /* The array to grow. may be NULL */ + int sz, /* Unit size in bytes */ + int *np, /* Pointer to current allocation number */ + int min, /* Number to allocate the first time */ + int maxinc) /* Maximum increment */ { if (cp == 0) { cp = malloc(min * sz); diff -r 34f2ffceb65e src/utils/circache.h --- a/src/utils/circache.h Mon May 16 09:39:11 2011 +0200 +++ b/src/utils/circache.h Mon May 16 10:22:01 2011 +0200 @@ -34,10 +34,6 @@ * * It is assumed that the dictionary are small (they are routinely read/parsed) * - * A problem with this approach is that repetitively storing the same - * object will evict all others. This could be somewhat optimized by reusing - * the last entry if it has the same udi as the one written, but not done - * currently. */ #include <sys/types.h>