translation of result list title. Show query details when clicking on header

This commit is contained in:
dockes 2006-01-11 15:08:22 +00:00
parent ef0a46711d
commit b38b88124a
10 changed files with 93 additions and 49 deletions

View File

@ -24,7 +24,7 @@
Dockes</holder> Dockes</holder>
</copyright> </copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.2 2006-01-10 11:07:21 dockes Exp $</releaseinfo> <releaseinfo>$Id: usermanual.sgml,v 1.3 2006-01-11 15:08:21 dockes Exp $</releaseinfo>
<abstract> <abstract>
<para>This document introduces full text search notions <para>This document introduces full text search notions
@ -369,6 +369,7 @@
character case should make a difference for a &RCL; character case should make a difference for a &RCL;
search.</para> search.</para>
</formalpara> </formalpara>
<formalpara><title>Phrases</title> <formalpara><title>Phrases</title>
<para>A phrase can be looked for by enclosing it in double <para>A phrase can be looked for by enclosing it in double
quotes. Example: <literal>"user manual"</literal> will look quotes. Example: <literal>"user manual"</literal> will look
@ -378,6 +379,12 @@
search dialog to the same effect.</para> search dialog to the same effect.</para>
</formalpara> </formalpara>
<formalpara><title>Query explanation</title>
<para>You can get an exact description of what the query
looked for, including stem expansion, and boolean operators
used, by clicking on the result list header.</para>
</formalpara>
<formalpara><title>Quitting</title> <formalpara><title>Quitting</title>
<para>Entering <keycap>^Q</keycap> almost anywhere will <para>Entering <keycap>^Q</keycap> almost anywhere will
close the application.</para> close the application.</para>

View File

@ -3,7 +3,7 @@ include ../mk/sysconf
PROGS = recollindex csguess mimetype PROGS = recollindex csguess mimetype
SRCS = recollindex.cpp SRCS = recollindex.cpp
all: $(PROGS) all: depend $(PROGS)
RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB) RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB)
recollindex : $(RECOLLINDEX_OBJS) recollindex : $(RECOLLINDEX_OBJS)

View File

@ -238,7 +238,7 @@ Click Cancel if you want to edit the configuration file before indexation starts
</message> </message>
<message> <message>
<source>Toolbar_2</source> <source>Toolbar_2</source>
<translation>Toolbar_2</translation> <translation type="obsolete">Toolbar_2</translation>
</message> </message>
<message> <message>
<source>Start &amp;Indexing</source> <source>Start &amp;Indexing</source>
@ -310,6 +310,26 @@ Click Cancel if you want to edit the configuration file before indexation starts
<source>&amp;User manual</source> <source>&amp;User manual</source>
<translation>&amp;Manuel</translation> <translation>&amp;Manuel</translation>
</message> </message>
<message>
<source>Query results</source>
<translation>Résultats de la recherche</translation>
</message>
<message>
<source>Query results (sorted)</source>
<translation>Résultats de la recherche (triés)</translation>
</message>
<message>
<source>Document history</source>
<translation>Historique des documents consultés</translation>
</message>
<message>
<source>Document history (sorted)</source>
<translation>Historique des documents consultés (trié)</translation>
</message>
<message>
<source>Query details</source>
<translation>Détail de la recherche</translation>
</message>
</context> </context>
<context> <context>
<name>SortForm</name> <name>SortForm</name>

View File

@ -199,14 +199,6 @@
<action name="prevPageAction"/> <action name="prevPageAction"/>
<action name="nextPageAction"/> <action name="nextPageAction"/>
</toolbar> </toolbar>
<toolbar dock="2">
<property name="name">
<cstring>HelpToolbar</cstring>
</property>
<property name="label">
<string>Toolbar_2</string>
</property>
</toolbar>
</toolbars> </toolbars>
<actions> <actions>
<action> <action>
@ -455,6 +447,7 @@
<include location="local" impldecl="in declaration">advsearch.h</include> <include location="local" impldecl="in declaration">advsearch.h</include>
<include location="local" impldecl="in declaration">sort.h</include> <include location="local" impldecl="in declaration">sort.h</include>
<include location="local" impldecl="in declaration">uiprefs.h</include> <include location="local" impldecl="in declaration">uiprefs.h</include>
<include location="local" impldecl="in declaration">rcldb.h</include>
<include location="local" impldecl="in implementation">recollmain.ui.h</include> <include location="local" impldecl="in implementation">recollmain.ui.h</include>
</includes> </includes>
<variables> <variables>
@ -467,6 +460,7 @@
<variable>bool reslist_dblclck;</variable> <variable>bool reslist_dblclck;</variable>
<variable>Preview *curPreview;</variable> <variable>Preview *curPreview;</variable>
<variable>advsearch *asearchform;</variable> <variable>advsearch *asearchform;</variable>
<variable>Rcl::AdvSearchData currentQueryData;</variable>
<variable>SortForm *sortform;</variable> <variable>SortForm *sortform;</variable>
<variable>UIPrefsDialog *uiprefs;</variable> <variable>UIPrefsDialog *uiprefs;</variable>
<variable>int sortwidth;</variable> <variable>int sortwidth;</variable>

View File

@ -343,10 +343,16 @@ void RecollMain::reslistTE_delayedclick()
// Document number // Document number
int reldocnum = reldocnumfromparnum(par); int reldocnum = reldocnumfromparnum(par);
// Bad number or already displayed. Forget it
if (reldocnum < 0) if (reldocnum < 0) {
// Bad number: must have clicked on header. Show details of query
QString desc = tr("Query details") + ": " +
currentQueryData.description.c_str();
QMessageBox::information(this, tr("Query details"), desc);
return; return;
startPreview(reslist_winfirst + reldocnum); } else {
startPreview(reslist_winfirst + reldocnum);
}
} }
// User asked to start query. Send it to the db aand call // User asked to start query. Send it to the db aand call
@ -389,12 +395,13 @@ void RecollMain::startAdvSearch(Rcl::AdvSearchData sdata)
delete docsource; delete docsource;
if (sortwidth > 0) { if (sortwidth > 0) {
DocSequenceDb myseq(rcldb); DocSequenceDb myseq(rcldb, tr("Query results"));
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs); docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
tr("Query results (sorted)"));
} else { } else {
docsource = new DocSequenceDb(rcldb); docsource = new DocSequenceDb(rcldb, tr("Query results"));
} }
currentQueryData = sdata;
showResultPage(); showResultPage();
} }
@ -781,22 +788,23 @@ void RecollMain::startManual()
startHelpBrowser(); startHelpBrowser();
} }
void RecollMain::showDocHistory() void RecollMain::showDocHistory()
{ {
LOGDEB(("RecollMain::showDocHistory\n")); LOGDEB(("RecollMain::showDocHistory\n"));
reslist_winfirst = -1; reslist_winfirst = -1;
curPreview = 0; curPreview = 0;
if (docsource) if (docsource)
delete docsource; delete docsource;
if (sortwidth > 0) { if (sortwidth > 0) {
DocSequenceHistory myseq(rcldb, history); DocSequenceHistory myseq(rcldb, history, tr("Document history"));
docsource = new DocSeqSorted(myseq, sortwidth, sortspecs); docsource = new DocSeqSorted(myseq, sortwidth, sortspecs,
tr("Document history (sorted)"));
} else { } else {
docsource = new DocSequenceHistory(rcldb, history); docsource = new DocSequenceHistory(rcldb, history,
tr("Document history"));
} }
currentQueryData.erase();
showResultPage(); showResultPage();
} }

View File

@ -1,6 +1,6 @@
#ifndef _DOCSEQ_H_INCLUDED_ #ifndef _DOCSEQ_H_INCLUDED_
#define _DOCSEQ_H_INCLUDED_ #define _DOCSEQ_H_INCLUDED_
/* @(#$Id: docseq.h,v 1.3 2005-12-05 16:13:12 dockes Exp $ (C) 2004 J.F.Dockes */ /* @(#$Id: docseq.h,v 1.4 2006-01-11 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes */
#include "rcldb.h" #include "rcldb.h"
#include "history.h" #include "history.h"
@ -11,11 +11,14 @@
history or Db query). We have an interface to make things cleaner. history or Db query). We have an interface to make things cleaner.
*/ */
class DocSequence { class DocSequence {
std::string m_title;
public: public:
DocSequence(const std::string &t) : m_title(t) {}
virtual ~DocSequence() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0) virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0)
= 0; = 0;
virtual int getResCnt() = 0; virtual int getResCnt() = 0;
virtual std::string title() = 0; virtual std::string title() {return m_title;}
}; };
@ -23,11 +26,12 @@ class DocSequence {
to make sense */ to make sense */
class DocSequenceDb : public DocSequence { class DocSequenceDb : public DocSequence {
public: public:
DocSequenceDb(Rcl::Db *d) : m_db(d), m_rescnt(-1) {} DocSequenceDb(Rcl::Db *d, const std::string &t) :
DocSequence(t), m_db(d), m_rescnt(-1)
{}
virtual ~DocSequenceDb() {} virtual ~DocSequenceDb() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string * = 0); virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string * = 0);
virtual int getResCnt(); virtual int getResCnt();
virtual std::string title() {return string("Query results");}
private: private:
Rcl::Db *m_db; Rcl::Db *m_db;
int m_rescnt; int m_rescnt;
@ -36,13 +40,12 @@ class DocSequenceDb : public DocSequence {
/** A DocSequence coming from the history file */ /** A DocSequence coming from the history file */
class DocSequenceHistory : public DocSequence { class DocSequenceHistory : public DocSequence {
public: public:
DocSequenceHistory(Rcl::Db *d, RclDHistory *h) DocSequenceHistory(Rcl::Db *d, RclDHistory *h, const std::string &t)
: m_db(d), m_hist(h), m_prevnum(-1), m_prevtime(-1) {} : DocSequence(t), m_db(d), m_hist(h), m_prevnum(-1), m_prevtime(-1) {}
virtual ~DocSequenceHistory() {} virtual ~DocSequenceHistory() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0); virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
virtual int getResCnt(); virtual int getResCnt();
virtual std::string title() {return string("Document history");}
private: private:
Rcl::Db *m_db; Rcl::Db *m_db;
RclDHistory *m_hist; RclDHistory *m_hist;

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.4 2005-12-05 12:02:01 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.5 2006-01-11 15:08:22 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
#include <algorithm> #include <algorithm>
@ -66,7 +66,9 @@ public:
} }
}; };
DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec) DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec,
const std::string &t)
: DocSequence(t)
{ {
LOGDEB(("DocSeqSorted:: count %d\n", cnt)); LOGDEB(("DocSeqSorted:: count %d\n", cnt));
@ -87,7 +89,6 @@ DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec)
for (i = 0; i < m_count; i++) for (i = 0; i < m_count; i++)
m_docsp[i] = &m_docs[i]; m_docsp[i] = &m_docs[i];
m_title = iseq.title() + " (sorted)";
CompareDocs cmp(sortspec); CompareDocs cmp(sortspec);
sort(m_docsp.begin(), m_docsp.end(), cmp); sort(m_docsp.begin(), m_docsp.end(), cmp);
} }

View File

@ -1,6 +1,6 @@
#ifndef _SORTSEQ_H_INCLUDED_ #ifndef _SORTSEQ_H_INCLUDED_
#define _SORTSEQ_H_INCLUDED_ #define _SORTSEQ_H_INCLUDED_
/* @(#$Id: sortseq.h,v 1.2 2005-12-02 16:18:20 dockes Exp $ (C) 2004 J.F.Dockes */ /* @(#$Id: sortseq.h,v 1.3 2006-01-11 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes */
#include <vector> #include <vector>
#include <string> #include <string>
@ -24,7 +24,8 @@ class RclSortSpec {
*/ */
class DocSeqSorted : public DocSequence { class DocSeqSorted : public DocSequence {
public: public:
DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec); DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec,
const std::string &t);
virtual ~DocSeqSorted() {} virtual ~DocSeqSorted() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0); virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
virtual int getResCnt() {return m_count;} virtual int getResCnt() {return m_count;}

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.50 2006-01-10 12:55:51 dockes Exp $ (C) 2004 J.F.Dockes"; static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.51 2006-01-11 15:08:21 dockes Exp $ (C) 2004 J.F.Dockes";
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -136,7 +136,7 @@ bool Rcl::Db::open(const string& dir, OpenMode mode)
} catch (...) { } catch (...) {
ermsg = "Caught unknown exception"; ermsg = "Caught unknown exception";
} }
LOGERR(("Rcl::Db::open: exception while opening '%s': %s\n", LOGERR(("Rcl::Db::open: exception while opening [%s]: %s\n",
dir.c_str(), ermsg)); dir.c_str(), ermsg));
return false; return false;
} }
@ -578,7 +578,7 @@ bool Rcl::Db::createStemDb(const string& lang)
string::iterator sit = (*it).begin(), eit = sit + (*it).length(); string::iterator sit = (*it).begin(), eit = sit + (*it).length();
if ((sit = find_if(sit, eit, p_notlowerorutf)) != eit) { if ((sit = find_if(sit, eit, p_notlowerorutf)) != eit) {
++nostem; ++nostem;
// LOGDEB(("stemskipped: '%s', because of 0x%x\n", // LOGDEB(("stemskipped: [%s], because of 0x%x\n",
// (*it).c_str(), *sit)); // (*it).c_str(), *sit));
continue; continue;
} }
@ -631,7 +631,7 @@ bool Rcl::Db::createStemDb(const string& lang)
ermsg = "Caught unknown exception"; ermsg = "Caught unknown exception";
} }
if (ermsg != "NOERROR") { if (ermsg != "NOERROR") {
LOGERR(("Rcl::Db::createstemdb: exception while opening '%s': %s\n", LOGERR(("Rcl::Db::createstemdb: exception while opening [%s]: %s\n",
stemdbdir.c_str(), ermsg)); stemdbdir.c_str(), ermsg));
return false; return false;
} }
@ -754,7 +754,7 @@ static list<string> stemexpand(Native *ndb, string term, const string& lang)
try { try {
Xapian::Stem stemmer(lang); Xapian::Stem stemmer(lang);
string stem = stemmer.stem_word(term); string stem = stemmer.stem_word(term);
LOGDEB(("stemexpand: '%s' stem-> '%s'\n", term.c_str(), stem.c_str())); LOGDEB(("stemexpand: [%s] stem-> [%s]\n", term.c_str(), stem.c_str()));
// Try to fetch the doc from the stem db // Try to fetch the doc from the stem db
string stemdbdir = stemdbname(ndb->basedir, lang); string stemdbdir = stemdbname(ndb->basedir, lang);
Xapian::Database sdb(stemdbdir); Xapian::Database sdb(stemdbdir);
@ -824,9 +824,12 @@ class wsQData : public TextSplitCB {
// Turn string into list of xapian queries. There is little // Turn string into list of xapian queries. There is little
// interpretation done on the string (no +term -term or filename:term // interpretation done on the string (no +term -term or filename:term
// stuff). We just separate words and phrases, and interpret // stuff). We just separate words and phrases, and interpret
// capitalized terms as wanting no stem expansion. Elements of the // capitalized terms as wanting no stem expansion.
// list corresponding to a stem-expanded part are an OR query of the // The final list contains one query for each term or phrase
// expanded elements // - Elements corresponding to a stem-expanded part are an OP_OR
// composition of the stem-expanded terms (or a single term query).
// - Elements corresponding to a phrase are an OP_PHRASE composition of the
// phrase terms (no stem expansion in this case)
static void stringToXapianQueries(const string &iq, static void stringToXapianQueries(const string &iq,
const string& stemlang, const string& stemlang,
Native *ndb, Native *ndb,
@ -848,7 +851,7 @@ static void stringToXapianQueries(const string &iq,
wsQData splitData; wsQData splitData;
TextSplit splitter(&splitData, true); TextSplit splitter(&splitData, true);
splitter.text_to_words(*it); splitter.text_to_words(*it);
LOGDEB(("strToXapianQ: splitter term count: %d\n", LOGDEB1(("strToXapianQ: splitter term count: %d\n",
splitData.terms.size())); splitData.terms.size()));
switch(splitData.terms.size()) { switch(splitData.terms.size()) {
case 0: continue;// ?? case 0: continue;// ??
@ -869,7 +872,7 @@ static void stringToXapianQueries(const string &iq,
nostemexp = true; nostemexp = true;
} }
} }
LOGDEB(("Term: %s stem expansion: %s\n", LOGDEB1(("Term: %s stem expansion: %s\n",
term.c_str(), nostemexp?"no":"yes")); term.c_str(), nostemexp?"no":"yes"));
list<string> exp; list<string> exp;
@ -903,7 +906,7 @@ static void stringToXapianQueries(const string &iq,
bool Rcl::Db::setQuery(const std::string &iqstring, QueryOpts opts, bool Rcl::Db::setQuery(const std::string &iqstring, QueryOpts opts,
const string& stemlang) const string& stemlang)
{ {
LOGDEB(("Rcl::Db::setQuery: q: '%s', opts 0x%x, stemlang %s\n", LOGDEB(("Rcl::Db::setQuery: q: [%s], opts 0x%x, stemlang %s\n",
iqstring.c_str(), (unsigned int)opts, stemlang.c_str())); iqstring.c_str(), (unsigned int)opts, stemlang.c_str()));
Native *ndb = (Native *)pdata; Native *ndb = (Native *)pdata;
if (!ndb) if (!ndb)
@ -1011,6 +1014,11 @@ bool Rcl::Db::setQuery(AdvSearchData &sdata, QueryOpts opts,
ndb->enquire = new Xapian::Enquire(ndb->db); ndb->enquire = new Xapian::Enquire(ndb->db);
ndb->enquire->set_query(ndb->query); ndb->enquire->set_query(ndb->query);
ndb->mset = Xapian::MSet(); ndb->mset = Xapian::MSet();
// Get the query description and trim the "Xapian::Query"
sdata.description = ndb->query.get_description();
if (sdata.description.find("Xapian::Query") == 0)
sdata.description = sdata.description.substr(strlen("Xapian::Query"));
LOGDEB(("Rcl::Db::SetQuery: Q: %s\n", sdata.description.c_str()));
return true; return true;
} }
@ -1169,7 +1177,7 @@ bool Rcl::Db::getDoc(int exti, Doc &doc, int *percent)
last = first + ndb->mset.size() -1; last = first + ndb->mset.size() -1;
} }
LOGDEB1(("Rcl::Db::getDoc: Qry '%s' win [%d-%d] Estimated results: %d", LOGDEB1(("Rcl::Db::getDoc: Qry [%s] win [%d-%d] Estimated results: %d",
ndb->query.get_description().c_str(), ndb->query.get_description().c_str(),
first, last, first, last,
ndb->mset.get_matches_lower_bound())); ndb->mset.get_matches_lower_bound()));

View File

@ -1,6 +1,6 @@
#ifndef _DB_H_INCLUDED_ #ifndef _DB_H_INCLUDED_
#define _DB_H_INCLUDED_ #define _DB_H_INCLUDED_
/* @(#$Id: rcldb.h,v 1.21 2006-01-09 16:53:31 dockes Exp $ (C) 2004 J.F.Dockes */ /* @(#$Id: rcldb.h,v 1.22 2006-01-11 15:08:21 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string> #include <string>
#include <list> #include <list>
@ -76,10 +76,12 @@ class AdvSearchData {
string nowords; string nowords;
list<string> filetypes; // restrict to types. Empty if inactive list<string> filetypes; // restrict to types. Empty if inactive
string topdir; // restrict to subtree. Empty if inactive string topdir; // restrict to subtree. Empty if inactive
string description; // Printable expanded version of the complete query
// returned after setQuery.
void erase() { void erase() {
allwords.erase();phrase.erase();orwords.erase();nowords.erase(); allwords.erase();phrase.erase();orwords.erase();nowords.erase();
filetypes.clear(); topdir.erase(); filetypes.clear(); topdir.erase();
description.clear();
} }
}; };