add excludedmimetypes configuration variable

This commit is contained in:
Jean-Francois Dockes 2014-05-02 10:07:26 +02:00
parent c897a09cd3
commit 030e576cdb
14 changed files with 210 additions and 109 deletions

View File

@ -85,17 +85,21 @@ bool ParamStale::needrecompute()
return false; return false;
} }
void ParamStale::init(RclConfig *rconf, ConfNull *cnf, const string& nm) void ParamStale::init(ConfNull *cnf)
{ {
parent = rconf;
conffile = cnf; conffile = cnf;
paramname = nm;
active = false; active = false;
if (conffile) if (conffile)
active = conffile->hasNameAnywhere(nm); active = conffile->hasNameAnywhere(paramname);
savedkeydirgen = -1; savedkeydirgen = -1;
} }
ParamStale::ParamStale(RclConfig *rconf, const string& nm)
: parent(rconf), conffile(0), paramname(nm),
active(false), savedkeydirgen(-1)
{
}
void RclConfig::zeroMe() { void RclConfig::zeroMe() {
m_ok = false; m_ok = false;
m_keydirgen = 0; m_keydirgen = 0;
@ -107,10 +111,12 @@ void RclConfig::zeroMe() {
m_ptrans = 0; m_ptrans = 0;
m_stopsuffixes = 0; m_stopsuffixes = 0;
m_maxsufflen = 0; m_maxsufflen = 0;
m_stpsuffstate.init(this, 0, "recoll_noindex");
m_skpnstate.init(this, 0, "skippedNames"); m_stpsuffstate.init(0);
m_rmtstate.init(this, 0, "indexedmimetypes"); m_skpnstate.init(0);
m_mdrstate.init(this, 0, "metadatacmds"); m_rmtstate.init(0);
m_xmtstate.init(0);
m_mdrstate.init(0);
} }
bool RclConfig::isDefaultConfig() const bool RclConfig::isDefaultConfig() const
@ -122,6 +128,11 @@ bool RclConfig::isDefaultConfig() const
} }
RclConfig::RclConfig(const string *argcnf) RclConfig::RclConfig(const string *argcnf)
: m_stpsuffstate(this, "recoll_noindex"),
m_skpnstate(this, "skippedNames"),
m_rmtstate(this, "indexedmimetypes"),
m_xmtstate(this, "excludedmimetypes"),
m_mdrstate(this, "metadatacmds")
{ {
zeroMe(); zeroMe();
@ -269,10 +280,12 @@ RclConfig::RclConfig(const string *argcnf)
m_ok = true; m_ok = true;
setKeyDir(cstr_null); setKeyDir(cstr_null);
m_stpsuffstate.init(this, mimemap, "recoll_noindex"); m_stpsuffstate.init(mimemap);
m_skpnstate.init(this, m_conf, "skippedNames"); m_skpnstate.init(m_conf);
m_rmtstate.init(this, m_conf, "indexedmimetypes"); m_rmtstate.init(m_conf);
m_mdrstate.init(this, m_conf, "metadatacmds"); m_xmtstate.init(m_conf);
m_mdrstate.init(m_conf);
return; return;
} }
@ -287,16 +300,20 @@ bool RclConfig::updateMainConfig()
stringsToString(m_cdirs, where); stringsToString(m_cdirs, where);
m_reason = string("No/bad main configuration file in: ") + where; m_reason = string("No/bad main configuration file in: ") + where;
m_ok = false; m_ok = false;
m_skpnstate.init(this, 0, "skippedNames"); m_skpnstate.init(0);
m_rmtstate.init(this, 0, "indexedmimetypes"); m_rmtstate.init(0);
m_mdrstate.init(this, 0, "metadatacmds"); m_xmtstate.init(0);
m_mdrstate.init(0);
return false; return false;
} }
delete m_conf; delete m_conf;
m_conf = newconf; m_conf = newconf;
m_skpnstate.init(this, m_conf, "skippedNames");
m_rmtstate.init(this, m_conf, "indexedmimetypes"); m_skpnstate.init(m_conf);
m_mdrstate.init(this, m_conf, "metadatacmds"); m_rmtstate.init(m_conf);
m_xmtstate.init(m_conf);
m_mdrstate.init(m_conf);
setKeyDir(cstr_null); setKeyDir(cstr_null);
bool nocjk = false; bool nocjk = false;
@ -677,17 +694,30 @@ bool RclConfig::getMimeCatTypes(const string& cat, vector<string>& tps) const
string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes) string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes)
{ {
string hs; string hs;
if (filtertypes && m_rmtstate.needrecompute()) {
m_restrictMTypes.clear(); if (filtertypes) {
stringToStrings(stringtolower((const string&)m_rmtstate.savedvalue), if(m_rmtstate.needrecompute()) {
m_restrictMTypes); m_restrictMTypes.clear();
} stringToStrings(stringtolower((const string&)m_rmtstate.savedvalue),
if (filtertypes && !m_restrictMTypes.empty()) { m_restrictMTypes);
string mt = mtype; }
stringtolower(mt); if (m_xmtstate.needrecompute()) {
if (m_restrictMTypes.find(mt) == m_restrictMTypes.end()) m_excludeMTypes.clear();
return hs; stringToStrings(stringtolower((const string&)m_xmtstate.savedvalue),
m_excludeMTypes);
}
if (!m_restrictMTypes.empty() &&
!m_restrictMTypes.count(stringtolower(mtype))) {
LOGDEB2(("RclConfig::getMimeHandlerDef: not in mime type list\n"));
return hs;
}
if (!m_excludeMTypes.empty() &&
m_excludeMTypes.count(stringtolower(mtype))) {
LOGDEB2(("RclConfig::getMimeHandlerDef: in excluded mime list\n"));
return hs;
}
} }
if (!mimeconf->get(mtype, hs, "index")) { if (!mimeconf->get(mtype, hs, "index")) {
LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str())); LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
} }
@ -1397,10 +1427,12 @@ void RclConfig::initFrom(const RclConfig& r)
m_maxsufflen = r.m_maxsufflen; m_maxsufflen = r.m_maxsufflen;
m_defcharset = r.m_defcharset; m_defcharset = r.m_defcharset;
m_stpsuffstate.init(this, mimemap, r.m_stpsuffstate.paramname); m_stpsuffstate.init(mimemap);
m_skpnstate.init(this, m_conf, r.m_skpnstate.paramname); m_skpnstate.init(m_conf);
m_rmtstate.init(this, m_conf, r.m_rmtstate.paramname); m_rmtstate.init(m_conf);
m_mdrstate.init(this, m_conf, r.m_mdrstate.paramname); m_xmtstate.init(m_conf);
m_mdrstate.init(m_conf);
m_thrConf = r.m_thrConf; m_thrConf = r.m_thrConf;
} }

View File

@ -22,6 +22,7 @@
#include <set> #include <set>
#include <utility> #include <utility>
#include <map> #include <map>
#include "unordered_defs.h"
using std::string; using std::string;
using std::vector; using std::vector;
@ -48,7 +49,8 @@ public:
int savedkeydirgen; int savedkeydirgen;
string savedvalue; string savedvalue;
void init(RclConfig *rconf, ConfNull *cnf, const string& nm); ParamStale(RclConfig *rconf, const string& nm);
void init(ConfNull *cnf);
bool needrecompute(); bool needrecompute();
}; };
@ -76,6 +78,19 @@ class RclConfig {
// argcnf // argcnf
RclConfig(const string *argcnf = 0); RclConfig(const string *argcnf = 0);
RclConfig(const RclConfig &r)
: m_stpsuffstate(this, "recoll_noindex"),
m_skpnstate(this, "skippedNames"),
m_rmtstate(this, "indexedmimetypes"),
m_xmtstate(this, "excludedmimetypes"),
m_mdrstate(this, "metadatacmds") {
initFrom(r);
}
~RclConfig() {
freeAll();
}
// Return a writable clone of the main config. This belongs to the // Return a writable clone of the main config. This belongs to the
// caller (must delete it when done) // caller (must delete it when done)
ConfNull *cloneMainConfig(); ConfNull *cloneMainConfig();
@ -226,15 +241,21 @@ class RclConfig {
/** fields: get field prefix from field name */ /** fields: get field prefix from field name */
bool getFieldTraits(const string& fldname, const FieldTraits **) const; bool getFieldTraits(const string& fldname, const FieldTraits **) const;
const set<string>& getStoredFields() const {return m_storedFields;} const set<string>& getStoredFields() const {return m_storedFields;}
set<string> getIndexedFields() const; set<string> getIndexedFields() const;
/** Get canonic name for possible alias */ /** Get canonic name for possible alias */
string fieldCanon(const string& fld) const; string fieldCanon(const string& fld) const;
/** Get xattr name to field names translations */ /** Get xattr name to field names translations */
const map<string, string>& getXattrToField() const {return m_xattrtofld;} const map<string, string>& getXattrToField() const {return m_xattrtofld;}
/** Get value of a parameter inside the "fields" file. Only some filters /** Get value of a parameter inside the "fields" file. Only some filters
use this (ie: mh_mail). The information specific to a given filter * use this (ie: mh_mail). The information specific to a given filter
is typically stored in a separate section(ie: [mail]) */ * is typically stored in a separate section(ie: [mail])
*/
vector<string> getFieldSectNames(const string &sk, const char* = 0) const; vector<string> getFieldSectNames(const string &sk, const char* = 0) const;
bool getFieldConfParam(const string &name, const string &sk, string &value) bool getFieldConfParam(const string &name, const string &sk, string &value)
const; const;
@ -272,13 +293,6 @@ class RclConfig {
return o_origcwd; return o_origcwd;
} }
~RclConfig() {
freeAll();
}
RclConfig(const RclConfig &r) {
initFrom(r);
}
RclConfig& operator=(const RclConfig &r) { RclConfig& operator=(const RclConfig &r) {
if (this != &r) { if (this != &r) {
freeAll(); freeAll();
@ -326,7 +340,11 @@ class RclConfig {
static string o_localecharset; static string o_localecharset;
// Limiting set of mime types to be processed. Normally empty. // Limiting set of mime types to be processed. Normally empty.
ParamStale m_rmtstate; ParamStale m_rmtstate;
set<string> m_restrictMTypes; STD_UNORDERED_SET<string> m_restrictMTypes;
// Exclusion set of mime types. Normally empty
ParamStale m_xmtstate;
STD_UNORDERED_SET<string> m_excludeMTypes;
vector<pair<int, int> > m_thrConf; vector<pair<int, int> > m_thrConf;
// Same idea with the metadata-gathering external commands, // Same idea with the metadata-gathering external commands,

View File

@ -374,20 +374,16 @@
contrary to define a positive list of types to be contrary to define a positive list of types to be
indexed. In the latter case, any type not in the list will indexed. In the latter case, any type not in the list will
be ignored.</para> be ignored.</para>
<para>Excluding types can be done by adding wildcard name <para>Excluding types can be done by adding wildcard name
patterns to the <literal>skippedNames</literal> list, which patterns to the <literal>skippedNames</literal> list, which
can be done from the GUI Index configuration menu. It is can be done from the GUI Index configuration menu. For
also possible to exclude a mime type independantly of the versions 1.20 and later, you can alternatively set the
file name by associating it with the <literal>excludedmimetypes</literal> list in the
<filename>rclnull</filename> input handler. This can be done configuration file. This can be redefined for
by editing the <link linkend="RCL.INSTALL.CONFIG.MIMECONF"> subdirectories.</para>
<filename>mimeconf</filename> configuration
file</link>.</para>
<para>In order to define a positive list, You need to edit the <para>You can also define an exclusive list of MIME types to be indexed (no others will be indexed), by settting
<link linkend="RCL.INSTALL.CONFIG.RECOLLCONF">main
configuration file
(<filename>recoll.conf</filename>)</link> and set
the <literal>indexedmimetypes</literal> configuration the <literal>indexedmimetypes</literal> configuration
variable. Example:<programlisting> variable. Example:<programlisting>
indexedmimetypes = text/html application/pdf indexedmimetypes = text/html application/pdf
@ -399,12 +395,17 @@ indexedmimetypes = application/pdf
</programlisting> </programlisting>
(When using sections like this, don't forget that they remain (When using sections like this, don't forget that they remain
in effect until the end of the file or another section in effect until the end of the file or another section
indicator). indicator).</para>
There is no GUI way to edit the parameter, because this
option runs contrary to &RCL; main goal which is to help you
find information, independantly of how it may be stored.
</para>
<para>In order to set <literal>excludedmimetypes</literal>
or <literal>indexedmimetypes</literal>, you need to edit the
<link linkend="RCL.INSTALL.CONFIG.RECOLLCONF">main
configuration file
(<filename>recoll.conf</filename>)</link>. I used to have
a bogus reason for this, but the really true truth is that
I was too lazy to extend the GUI for these relatively
rarely used parameters.
</para>
@ -789,7 +790,7 @@ recoll
<varlistentry> <varlistentry>
<term>mime_type</term> <term>mime_type</term>
<listitem><para>If set, this overrides any other <listitem><para>If set, this overrides any other
determination of the file mime type.</para></listitem> determination of the file MIME type.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>charset</term> <term>charset</term>
@ -1253,11 +1254,11 @@ fs.inotify.max_user_watches=32768
uncheck the <guilabel>Use desktop preferences</guilabel> option in uncheck the <guilabel>Use desktop preferences</guilabel> option in
the GUI preferences dialog, and click the <guilabel>Choose editor the GUI preferences dialog, and click the <guilabel>Choose editor
applications</guilabel> button to adjust the predefined &RCL; applications</guilabel> button to adjust the predefined &RCL;
choices. The tool accepts multiple selections of mime types (e.g. to choices. The tool accepts multiple selections of MIME types (e.g. to
set up the editor for the dozens of office file types).</para> set up the editor for the dozens of office file types).</para>
<para>Even when <guilabel>Use desktop preferences</guilabel> is <para>Even when <guilabel>Use desktop preferences</guilabel> is
checked, there is a small list of exceptions, for mime types where checked, there is a small list of exceptions, for MIME types where
the &RCL; choice should override the desktop one. These are the &RCL; choice should override the desktop one. These are
applications which are well integrated with &RCL;, especially applications which are well integrated with &RCL;, especially
<application>evince</application> for viewing PDF and Postscript <application>evince</application> for viewing PDF and Postscript
@ -1559,7 +1560,7 @@ fs.inotify.max_user_watches=32768
</listitem> </listitem>
<listitem><para>The second tab lets filter the results according <listitem><para>The second tab lets filter the results according
to file size, date of modification, mime type, or to file size, date of modification, MIME type, or
location.</para> location.</para>
</listitem> </listitem>
@ -1656,8 +1657,8 @@ fs.inotify.max_user_watches=32768
</listitem> </listitem>
<listitem> <listitem>
<para>The next section allows filtering the results by their mime <para>The next section allows filtering the results by their MIME
types, or mime categories (ie: media/text/message/etc.).</para> types, or MIME categories (ie: media/text/message/etc.).</para>
<para>You can transfer the types between two boxes, to define <para>You can transfer the types between two boxes, to define
which will be included or excluded by the search.</para> which will be included or excluded by the search.</para>
<para>The state of the file type selection can be saved as <para>The state of the file type selection can be saved as
@ -2178,7 +2179,7 @@ fs.inotify.max_user_watches=32768
</listitem> </listitem>
<listitem><para><guilabel>Exceptions</guilabel>: when using the <listitem><para><guilabel>Exceptions</guilabel>: when using the
desktop preferences for opening documents, these are mime types desktop preferences for opening documents, these are MIME types
that will still be opened according to &RCL; preferences. This that will still be opened according to &RCL; preferences. This
is useful for passing parameters like page numbers or search is useful for passing parameters like page numbers or search
strings to applications that support them strings to applications that support them
@ -2403,7 +2404,7 @@ fs.inotify.max_user_watches=32768
<listitem><formalpara><title>%D</title><para>Date</para></formalpara> <listitem><formalpara><title>%D</title><para>Date</para></formalpara>
</listitem> </listitem>
<listitem><formalpara><title>%I</title><para>Icon image <listitem><formalpara><title>%I</title><para>Icon image
name. This is normally determined from the mime type. The name. This is normally determined from the MIME type. The
associations are defined inside the associations are defined inside the
<link linkend="RCL.INSTALL.CONFIG.MIMECONF"> <link linkend="RCL.INSTALL.CONFIG.MIMECONF">
<filename>mimeconf</filename> configuration file</link>. <filename>mimeconf</filename> configuration file</link>.
@ -2417,7 +2418,7 @@ fs.inotify.max_user_watches=32768
<listitem><formalpara><title>%L</title><para>Precooked Preview, <listitem><formalpara><title>%L</title><para>Precooked Preview,
Edit, and possibly Snippets links</para></formalpara> Edit, and possibly Snippets links</para></formalpara>
</listitem> </listitem>
<listitem><formalpara><title>%M</title><para>Mime <listitem><formalpara><title>%M</title><para>MIME
type</para></formalpara> type</para></formalpara>
</listitem> </listitem>
<listitem><formalpara><title>%N</title><para>result Number inside <listitem><formalpara><title>%N</title><para>result Number inside
@ -2922,7 +2923,7 @@ dir:recoll dir:src -dir:utils -dir:common
<listitem><para><literal>mime</literal> or <listitem><para><literal>mime</literal> or
<literal>format</literal> for specifying the <literal>format</literal> for specifying the
mime type. This one is quite special because you can specify MIME type. This one is quite special because you can specify
several values which will be OR'ed (the normal default for the several values which will be OR'ed (the normal default for the
language is AND). Ex: <literal>mime:text/plain language is AND). Ex: <literal>mime:text/plain
mime:text/html</literal>. Specifying an explicit boolean mime:text/html</literal>. Specifying an explicit boolean
@ -2939,12 +2940,12 @@ dir:recoll dir:src -dir:utils -dir:common
<listitem><para><literal>type</literal> or <listitem><para><literal>type</literal> or
<literal>rclcat</literal> for specifying the category (as in <literal>rclcat</literal> for specifying the category (as in
text/media/presentation/etc.). The classification of mime text/media/presentation/etc.). The classification of MIME
types in categories is defined in the &RCL; configuration types in categories is defined in the &RCL; configuration
(<filename>mimeconf</filename>), and can be modified or (<filename>mimeconf</filename>), and can be modified or
extended. The default category names are those which permit extended. The default category names are those which permit
filtering results in the main GUI screen. Categories are OR'ed filtering results in the main GUI screen. Categories are OR'ed
like mime types above. This can't be negated with like MIME types above. This can't be negated with
<literal>-</literal> either.</para> <literal>-</literal> either.</para>
</listitem> </listitem>
@ -3480,10 +3481,10 @@ dir:recoll dir:src -dir:utils -dir:common
<title>Telling &RCL; about the handler</title> <title>Telling &RCL; about the handler</title>
<para>There are two elements that link a file to the handler which <para>There are two elements that link a file to the handler which
should process it: the association of file to mime type and the should process it: the association of file to MIME type and the
association of a mime type with a handler.</para> association of a MIME type with a handler.</para>
<para>The association of files to mime types is mostly based on <para>The association of files to MIME types is mostly based on
name suffixes. The types are defined inside the name suffixes. The types are defined inside the
<link linkend="RCL.INSTALL.CONFIG.MIMEMAP"> <link linkend="RCL.INSTALL.CONFIG.MIMEMAP">
<filename>mimemap</filename> file</link>. Example: <filename>mimemap</filename> file</link>. Example:
@ -3493,7 +3494,7 @@ dir:recoll dir:src -dir:utils -dir:common
</programlisting> </programlisting>
If no suffix association is found for the file name, &RCL; will try If no suffix association is found for the file name, &RCL; will try
to execute the <command>file -i</command> command to determine a to execute the <command>file -i</command> command to determine a
mime type.</para> MIME type.</para>
<para>The association of file types to handlers is performed in <para>The association of file types to handlers is performed in
the <link linkend="RCL.INSTALL.CONFIG.MIMECONF"> the <link linkend="RCL.INSTALL.CONFIG.MIMECONF">
@ -5020,12 +5021,18 @@ skippedPaths = ~/somedir/*.txt
<varlistentry><term><varname>indexedmimetypes</varname></term> <varlistentry><term><varname>indexedmimetypes</varname></term>
<listitem><para>&RCL; normally indexes any file which it <listitem><para>&RCL; normally indexes any file which it
knows how to read. This list lets you restrict the indexed knows how to read. This list lets you restrict the indexed
mime types to what you specify. If the variable is MIME types to what you specify. If the variable is
unspecified or the list empty (the default), all supported unspecified or the list empty (the default), all supported
types are processed. Can be redefined for subdirectories.</para> types are processed. Can be redefined for subdirectories.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry><term><varname>excludedmimetypes</varname></term>
<listitem><para> This list lets you exclude some MIME types from
indexing. Can be redefined for subdirectories.</para>
</listitem>
</varlistentry>
<varlistentry><term><varname>compressedfilemaxkbs</varname></term> <varlistentry><term><varname>compressedfilemaxkbs</varname></term>
<listitem><para>Size limit for compressed (.gz or .bz2) <listitem><para>Size limit for compressed (.gz or .bz2)
files. These need to be decompressed in a temporary files. These need to be decompressed in a temporary
@ -5064,17 +5071,17 @@ skippedPaths = ~/somedir/*.txt
<listitem><para>&RCL; indexes file names in a special <listitem><para>&RCL; indexes file names in a special
section of the database to allow specific file names section of the database to allow specific file names
searches using wild cards. This parameter decides if searches using wild cards. This parameter decides if
file name indexing is performed only for files with mime file name indexing is performed only for files with MIME
types that would qualify them for full text indexing, or types that would qualify them for full text indexing, or
for all files inside the selected subtrees, independently of for all files inside the selected subtrees, independently of
mime type.</para> MIME type.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry><term><varname>usesystemfilecommand</varname></term> <varlistentry><term><varname>usesystemfilecommand</varname></term>
<listitem><para>Decide if we use the <listitem><para>Decide if we use the
<command>file</command> <option>-i</option> system command <command>file</command> <option>-i</option> system command
as a final step for determining the mime type for a file as a final step for determining the MIME type for a file
(the main procedure uses suffix associations as defined in (the main procedure uses suffix associations as defined in
the <filename>mimemap</filename> file). This can be useful the <filename>mimemap</filename> file). This can be useful
for files with suffix-less names, but it will also cause for files with suffix-less names, but it will also cause
@ -5739,12 +5746,12 @@ x-my-tag = mailmytag
<title>The mimemap file</title> <title>The mimemap file</title>
<para><filename>mimemap</filename> specifies the <para><filename>mimemap</filename> specifies the
file name extension to mime type mappings.</para> file name extension to MIME type mappings.</para>
<para>For file names without an extension, or with an unknown <para>For file names without an extension, or with an unknown
one, the system's <command>file</command> <option>-i</option> one, the system's <command>file</command> <option>-i</option>
command will be command will be
executed to determine the mime type (this can be switched off executed to determine the MIME type (this can be switched off
inside the main configuration file).</para> inside the main configuration file).</para>
<para>The mappings can be specified on a per-subtree basis, <para>The mappings can be specified on a per-subtree basis,
@ -5776,7 +5783,7 @@ x-my-tag = mailmytag
<title>The mimeconf file</title> <title>The mimeconf file</title>
<para><filename>mimeconf</filename> specifies how the <para><filename>mimeconf</filename> specifies how the
different mime types are handled for indexing, and which icons different MIME types are handled for indexing, and which icons
are displayed in the <command>recoll</command> result lists.</para> are displayed in the <command>recoll</command> result lists.</para>
<para>Changing the parameters in the [index] section is <para>Changing the parameters in the [index] section is
@ -5813,7 +5820,7 @@ x-my-tag = mailmytag
use <command>xdg-open</command> by default).</para> use <command>xdg-open</command> by default).</para>
<para>In this case, the <literal>xallexcepts</literal> top level <para>In this case, the <literal>xallexcepts</literal> top level
variable defines a list of mime type exceptions which variable defines a list of MIME type exceptions which
will be processed according to the local entries instead of being will be processed according to the local entries instead of being
passed to the desktop. This is so that specific &RCL; options passed to the desktop. This is so that specific &RCL; options
such as a page number or a search string can be passed to such as a page number or a search string can be passed to
@ -5829,7 +5836,7 @@ x-my-tag = mailmytag
<para>All viewer definition entries must be placed under a <para>All viewer definition entries must be placed under a
<literal>[view]</literal> section.</para> <literal>[view]</literal> section.</para>
<para>The keys in the file are normally mime types. You can add an <para>The keys in the file are normally MIME types. You can add an
application tag to specialize the choice for an area of the application tag to specialize the choice for an area of the
filesystem (using a <varname>localfields</varname> specification filesystem (using a <varname>localfields</varname> specification
in <filename>mimeconf</filename>). The syntax for the key is in <filename>mimeconf</filename>). The syntax for the key is
@ -5837,7 +5844,7 @@ x-my-tag = mailmytag
<para>The <varname>nouncompforviewmts</varname> entry, (placed at <para>The <varname>nouncompforviewmts</varname> entry, (placed at
the top level, outside of the <literal>[view]</literal> section), the top level, outside of the <literal>[view]</literal> section),
holds a list of mime types that should not be uncompressed before holds a list of MIME types that should not be uncompressed before
starting the viewer (if they are found compressed, ie: starting the viewer (if they are found compressed, ie:
<replaceable>mydoc.doc.gz</replaceable>).</para> <replaceable>mydoc.doc.gz</replaceable>).</para>
@ -5871,7 +5878,7 @@ x-my-tag = mailmytag
</listitem> </listitem>
<listitem><formalpara><title>%M</title> <listitem><formalpara><title>%M</title>
<para>Mime type</para></formalpara> <para>MIME type</para></formalpara>
</listitem> </listitem>
<listitem><formalpara><title>%p</title> <listitem><formalpara><title>%p</title>
@ -5950,7 +5957,7 @@ x-my-tag = mailmytag
following line:<programlisting> following line:<programlisting>
.blob = application/x-blobapp .blob = application/x-blobapp
</programlisting> </programlisting>
Note that the mime type is made up here, and you could Note that the MIME type is made up here, and you could
call it <replaceable>diesel/oil</replaceable> just the call it <replaceable>diesel/oil</replaceable> just the
same.</para> same.</para>
</listitem> </listitem>
@ -5967,7 +5974,7 @@ application/x-blobapp = blobviewer %f
</itemizedlist> </itemizedlist>
<para>If you just wanted to change the application used by <para>If you just wanted to change the application used by
&RCL; to display a mime type which it already knows, you &RCL; to display a MIME type which it already knows, you
would just need to edit <filename>mimeview</filename>. The would just need to edit <filename>mimeview</filename>. The
entries you add in your personal file override those in the entries you add in your personal file override those in the
central configuration, which you do not need to central configuration, which you do not need to
@ -6001,7 +6008,7 @@ application/x-blobapp = exec rclblob
<filename>/usr/[local/]share/recoll/images</filename>.</para> <filename>/usr/[local/]share/recoll/images</filename>.</para>
</listitem> </listitem>
<listitem><para>Under the <literal>[categories]</literal> <listitem><para>Under the <literal>[categories]</literal>
section, you should add the mime type where it makes sense section, you should add the MIME type where it makes sense
(you can also create a category). Categories may be used (you can also create a category). Categories may be used
for filtering in advanced search.</para> for filtering in advanced search.</para>
</listitem> </listitem>

View File

@ -48,7 +48,17 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
popup->addAction(me->tr("&Open"), me, SLOT(menuEdit())); popup->addAction(me->tr("&Open"), me, SLOT(menuEdit()));
} }
if (doc.ipath.empty()) { bool needopenwith = true;
if (!doc.ipath.empty())
needopenwith = false;
if (needopenwith) {
string backend;
doc.getmeta(Rcl::Doc::keybcknd, &backend);
if (!backend.empty() && backend.compare("FS"))
needopenwith = false;
}
if (needopenwith) {
vector<DesktopDb::AppDef> aps; vector<DesktopDb::AppDef> aps;
DesktopDb *ddb = DesktopDb::getDb(); DesktopDb *ddb = DesktopDb::getDb();
if (ddb && ddb->appForMime(doc.mimetype, &aps) && if (ddb && ddb->appForMime(doc.mimetype, &aps) &&

View File

@ -199,7 +199,12 @@ indexallfilenames = 1
# will be indexed anyway if indexallfilenames is set as by default). Mime # will be indexed anyway if indexallfilenames is set as by default). Mime
# type names should be taken from the mimemap file. # type names should be taken from the mimemap file.
# #
# indexedmimetypes = text/html application/pdf # indexedmimetypes =
# An excluded list of mime types. It can be redefined in subdirectories,
# so can be used to locally exclude some types.
#
# excludededmimetypes =
# #
# Size limit for archive members. This is passed to the filters in the # Size limit for archive members. This is passed to the filters in the

View File

@ -291,6 +291,8 @@ template bool stringToStrings<vector<string> >(const string &,
vector<string> &,const string&); vector<string> &,const string&);
template bool stringToStrings<set<string> >(const string &, template bool stringToStrings<set<string> >(const string &,
set<string> &, const string&); set<string> &, const string&);
template bool stringToStrings<STD_UNORDERED_SET<string> >
(const string &, STD_UNORDERED_SET<string> &, const string&);
template <class T> void stringsToString(const T &tokens, string &s) template <class T> void stringsToString(const T &tokens, string &s)
{ {

View File

@ -24,12 +24,10 @@
#include <map> #include <map>
#include <set> #include <set>
#ifndef NO_NAMESPACES
using std::string; using std::string;
using std::vector; using std::vector;
using std::map; using std::map;
using std::set; using std::set;
#endif /* NO_NAMESPACES */
// Note these are all ascii routines // Note these are all ascii routines
extern int stringicmp(const string& s1, const string& s2); extern int stringicmp(const string& s1, const string& s2);

View File

@ -5,10 +5,11 @@ topdir=`dirname $0`/..
initvariables $0 initvariables $0
recollq 'boolean_uniqueterm One OR Two -Three' 2> $mystderr | (
egrep -v '^Recoll query: ' > $mystdout recollq 'boolean_uniqueterm One OR Two -Three'
diff -w ${myname}.txt 2>> $mystderr | ) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout
egrep -v '^Recoll query: ' >> $mystdout
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1
checkresult checkresult

View File

@ -31,3 +31,11 @@ mhmboxquirks = tbird
[/home/dockes/projets/fulltext/testrecoll/cjk] [/home/dockes/projets/fulltext/testrecoll/cjk]
localfields= ; keyword = ckjtsthuniique; blabla= "some string" localfields= ; keyword = ckjtsthuniique; blabla= "some string"
[/home/dockes/projets/fulltext/testrecoll/idxtypes]
indexedmimetypes = text/plain
[/home/dockes/projets/fulltext/testrecoll/excltypes]
excludedmimetypes = text/plain

View File

@ -4,9 +4,10 @@ topdir=`dirname $0`/..
. $topdir/shared.sh . $topdir/shared.sh
initvariables $0 initvariables $0
( (
# Only # Only
recollq filename:testdirfile dir:testrecoll/dir/d1 OR recollq filename:testdirfile dir:testrecoll/dir/d1 OR \
dir:testrecoll/dir/d2 -dir:d2 dir:testrecoll/dir/d2 -dir:d2
) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout ) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout

22
tests/incexcl/incexcl.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
thisdir=`dirname $0`
topdir=$thisdir/..
. $topdir/shared.sh
initvariables $0
(
echo "Should find idxtypes/idxt.txt only"
recollq idxtypesunique
echo
echo "Should find idxtypes/idxt.html only"
recollq excltypesunique
) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1
checkresult

View File

@ -0,0 +1,7 @@
Should find idxtypes/idxt.txt only
1 results
text/plain [file:///home/dockes/projets/fulltext/testrecoll/idxtypes/idxt.txt] [idxt.txt] 16 bytes
Should find idxtypes/idxt.html only
1 results
text/html [file:///home/dockes/projets/fulltext/testrecoll/excltypes/idxt.html] [idxt.html] 69 bytes

View File

@ -197,18 +197,8 @@ branch for the current production version.</p>
<p> <p>
<a href="recoll-1.19.9.tar.gz">1.19.9</a>. <a href="recoll-1.19.9.tar.gz">1.19.9</a>.
<a href="recoll-1.19.8.tar.gz">1.19.8</a>.
<a href="recoll-1.19.7.tar.gz">1.19.7</a>.
<a href="recoll-1.19.5.tar.gz">1.19.5</a>.
<a href="recoll-1.19.4.tar.gz">1.19.4</a>.
<a href="recoll-1.19.3.tar.gz">1.19.3</a>.
<a href="recoll-1.19.2.tar.gz">1.19.2</a>.
<a href="recoll-1.18.2.tar.gz">1.18.2</a>. <a href="recoll-1.18.2.tar.gz">1.18.2</a>.
<a href="recoll-1.17.3.tar.gz">1.17.3</a>. <a href="recoll-1.17.3.tar.gz">1.17.3</a>.
<a href="recoll-1.16.2.tar.gz">1.16.2</a>.
<a href="recoll-1.15.9.tar.gz">1.15.9</a>.
<a href="recoll-1.14.4.tar.gz">1.14.4</a>.
<a href="recoll-1.13.04.tar.gz">1.13.04</a>.
</p> </p>
</div> </div>

View File

@ -64,7 +64,7 @@ Configuration</em> menu.</p>
<h2><a name="minor_releases">Minor releases at a glance</a></h2> <h2><a name="minor_releases">Minor releases at a glance</a></h2>
<ul> <ul>
<li>1.19.12p2 fulfills an old promise that I had forgotten: have a <li>1.19.12p2 fulfills an old promise that I had forgotten: have a
double-clik in the result table run an "open file" action. It just double-click in the result table run an "open file" action. It just
had waited for too long...</li> had waited for too long...</li>
<li>1.19.12p1 fixes the 1.19.12 install script which did not <li>1.19.12p1 fixes the 1.19.12 install script which did not
actually copy the xls filter...</li> actually copy the xls filter...</li>