diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml
index 99553ed9..1067a6f9 100644
--- a/src/doc/user/usermanual.sgml
+++ b/src/doc/user/usermanual.sgml
@@ -24,7 +24,7 @@
Dockes
- $Id: usermanual.sgml,v 1.22 2006-10-12 08:39:55 dockes Exp $
+ $Id: usermanual.sgml,v 1.23 2006-11-06 17:37:22 dockes Exp $
This document introduces full text search notions
@@ -609,6 +609,67 @@ recoll
+
+ The term explorer tool
+
+ &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.
+
+ The term explorer tool (started from the toolbar icon or
+ from the Term explorer entry of the
+ Tools menu) can be used to search the full index
+ terms list. It has three modes of operations:
+
+
+
+ Wildcard
+ In this mode of operation, you can enter a
+ search string with shell-like wildcards (*, ?). ie:
+ xapi* .
+
+
+
+ Regular expression
+ This mode will accept a regular expression
+ as input. Example:
+ word[0-9]+ . The regular
+ expression is anchored by enclosing in
+ ^ and $ before
+ execution.
+
+
+
+ Spelling/Phonetic 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
+ Aspell 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.
+
+
+
+ Note that in cases where &RCL; does not know the beginning
+ of the string to search for (ie a wildcard expression like
+ *coll), 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.
+
+ 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).
+
+
+
Multiple databases
@@ -969,12 +1030,12 @@ recoll
- Packages needed for external file types
+ Supporting packages
- &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;):
+ &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;):
diff --git a/src/qtgui/rclmain.ui b/src/qtgui/rclmain.ui
index d1d6e33f..8c6cb31a 100644
--- a/src/qtgui/rclmain.ui
+++ b/src/qtgui/rclmain.ui
@@ -240,10 +240,10 @@
spell.png
- Spelling &expansion
+ Term &explorer
- Spelling expansion tool
+ Term explorer tool
diff --git a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp
index 9c0a3a44..e1a7e547 100644
--- a/src/qtgui/spell_w.cpp
+++ b/src/qtgui/spell_w.cpp
@@ -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()));
}
diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp
index 79dd7378..745bb231 100644
--- a/src/rcldb/rcldb.cpp
+++ b/src/rcldb/rcldb.cpp
@@ -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& res,
@@ -1195,13 +1195,21 @@ bool Db::termMatch(MatchType typ, const string &root, list& res,
regex_t reg;
int errcode;
- if (typ == ET_REGEXP && (errcode=regcomp(®, droot.c_str(), 0))) {
- char errbuf[200];
- regerror(errcode, ®, errbuf, 199);
- LOGERR(("termMatch: regcomp failed: %s\n", errbuf));
- res.push_back(errbuf);
- regfree(®);
- 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(®, mroot.c_str(), REG_EXTENDED|REG_NOSUB))) {
+ char errbuf[200];
+ regerror(errcode, ®, errbuf, 199);
+ LOGERR(("termMatch: regcomp failed: %s\n", errbuf));
+ res.push_back(errbuf);
+ regfree(®);
+ return false;
+ }
}
// Find the initial section before any special char
@@ -1231,7 +1239,8 @@ bool Db::termMatch(MatchType typ, const string &root, list& res,
if (regexec(®, (*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 {