wrote manual for term explorer and fixed a few problems

This commit is contained in:
dockes 2006-11-06 17:37:22 +00:00
parent 1384276a3f
commit b4a4eb76d8
4 changed files with 95 additions and 21 deletions

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.22 2006-10-12 08:39:55 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.23 2006-11-06 17:37:22 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -609,6 +609,67 @@ recoll
</sect1>
<sect1 id="rcl.search.termexplorer">
<title>The term explorer tool</title>
<para>&RCL; automatically manages the expansion of search terms
to their derivatives (ie: plural/singular, verb
inflections). But there are other cases where the exact search
term is not known. For example, you may not remember the exact
spelling, or only know the beginning of the name.</para>
<para>The term explorer tool (started from the toolbar icon or
from the <guilabel>Term explorer</guilabel> entry of the
<guilabel>Tools</guilabel> menu) can be used to search the full index
terms list. It has three modes of operations:</para>
<variablelist>
<varlistentry>
<term>Wildcard</term>
<listitem><para>In this mode of operation, you can enter a
search string with shell-like wildcards (*, ?). ie:
<replaceable>xapi*</replaceable> .</para></listitem>
</varlistentry>
<varlistentry>
<term>Regular expression</term>
<listitem><para>This mode will accept a regular expression
as input. Example:
<replaceable>word[0-9]+</replaceable> . The regular
expression is anchored by enclosing in
<literal>^</literal> and <literal>$</literal> before
execution.</para></listitem>
</varlistentry>
<varlistentry>
<term>Spelling/Phonetic</term> <listitem><para>In this
mode, you enter the term as you think it is spelled, and
&RCL; will do its best to find index terms that sound like
your entry. This mode uses the
<application>Aspell</application> spelling application,
which must be installed on your system for things to
work. The language which is used to build the dictionary
out of the index terms (which is done at the end of an
indexing pass) is the one defined by your NLS
environment. Weird things will probably happen if
languages are mixed up.</para></listitem>
</varlistentry>
</variablelist>
<para>Note that in cases where &RCL; does not know the beginning
of the string to search for (ie a wildcard expression like
<replaceable>*coll</replaceable>), the expansion can take quite
a long time because the full index term list will have to be
processed. The expansion is currently limited at 200 results for
wildcards and regular expressions.</para>
<para>Double-clicking on a term in the result list will insert
it into the simple search entry field. You can also cut/paste
between the result list and any entry field (the end of lines
will be taken care of).</para>
</sect1>
<sect1 id="rcl.search.multidb">
<title>Multiple databases</title>
@ -969,12 +1030,12 @@ recoll
</sect1>
<sect1 id="rcl.install.external">
<title>Packages needed for external file types</title>
<title>Supporting packages</title>
<para>&RCL; uses external applications
to index some file types. You need to install them for the
file types that you wish to have indexed (these are run-time
dependencies. None is needed for building &RCL;):</para>
<para>&RCL; uses external applications to index some file
types. You need to install them for the file types that you wish to
have indexed (these are run-time dependencies. None is needed for
building &RCL;):</para>
<itemizedlist>

View File

@ -240,10 +240,10 @@
<iconset>spell.png</iconset>
</property>
<property name="menuText">
<string>Spelling &amp;expansion</string>
<string>Term &amp;explorer</string>
</property>
<property name="toolTip">
<string>Spelling expansion tool</string>
<string>Term explorer tool</string>
</property>
</action>
<action>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: spell_w.cpp,v 1.4 2006-11-04 17:09:08 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: spell_w.cpp,v 1.5 2006-11-06 17:37:22 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -96,12 +96,16 @@ void SpellW::doExpand()
case 2: {
LOGDEB(("SpellW::doExpand: aspelling\n"));
if (!aspell) {
QMessageBox::warning(0, "Recoll",
tr("Aspell init failed. "
"Aspell not installed?"));
LOGDEB(("SpellW::doExpand: aspell init error\n"));
return;
}
if (!aspell->suggest(*rcldb, expr, suggs, reason)) {
QMessageBox::warning(0, "Recoll",
tr("Aspell expansion error. "));
LOGERR(("SpellW::doExpand:suggest failed: %s\n", reason.c_str()));
return;
}
}
#endif
@ -131,7 +135,7 @@ void SpellW::wordChanged(const QString &text)
void SpellW::textDoubleClicked(int para, int)
{
suggsTE->setSelection(para, 0, para+1, 0);
suggsTE->setSelection(para, 0, para, 1000);
if (suggsTE->hasSelectedText())
emit(wordSelect(suggsTE->selectedText()));
}

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.85 2006-10-30 12:59:44 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.86 2006-11-06 17:37:22 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -1178,7 +1178,7 @@ bool Db::setQuery(AdvSearchData &sdata, int opts, const string& stemlang)
// to begin the allterms search with terms that begin with the portion of
// the input string prior to these chars.
const string wildSpecChars = "*?[";
const string regSpecChars = "(.[{^";
const string regSpecChars = "(.[{";
// Find all index terms that match a wildcard or regular expression
bool Db::termMatch(MatchType typ, const string &root, list<string>& res,
@ -1195,13 +1195,21 @@ bool Db::termMatch(MatchType typ, const string &root, list<string>& res,
regex_t reg;
int errcode;
if (typ == ET_REGEXP && (errcode=regcomp(&reg, droot.c_str(), 0))) {
char errbuf[200];
regerror(errcode, &reg, errbuf, 199);
LOGERR(("termMatch: regcomp failed: %s\n", errbuf));
res.push_back(errbuf);
regfree(&reg);
return false;
// Compile regexp. We anchor the input by enclosing it in ^ and $
if (typ == ET_REGEXP) {
string mroot = droot;
if (mroot.at(0) != '^')
mroot = string("^") + mroot;
if (mroot.at(mroot.length()-1) != '$')
mroot += "$";
if ((errcode = regcomp(&reg, mroot.c_str(), REG_EXTENDED|REG_NOSUB))) {
char errbuf[200];
regerror(errcode, &reg, errbuf, 199);
LOGERR(("termMatch: regcomp failed: %s\n", errbuf));
res.push_back(errbuf);
regfree(&reg);
return false;
}
}
// Find the initial section before any special char
@ -1231,7 +1239,8 @@ bool Db::termMatch(MatchType typ, const string &root, list<string>& res,
if (regexec(&reg, (*it).c_str(), 0, 0, 0))
continue;
}
if (lang.empty()) {
// Do we want stem expansion here? We don't do it for now
if (1 || lang.empty()) {
res.push_back(*it);
++n;
} else {