Result list: improve the spelling suggestions now presented as links which will replace the appropriate word inside the query

This commit is contained in:
Jean-Francois Dockes
2012-02-17 09:01:28 +01:00
parent cc5ba21d79
commit f6e50fd9eb
7 changed files with 64 additions and 18 deletions
+15 -8
View File
@@ -290,17 +290,24 @@ void ResListPager::displayPage(RclConfig *config)
vector<string>uterms;
m_docSource->getUTerms(uterms);
if (!uterms.empty()) {
vector<string> spellings;
map<string, vector<string> > spellings;
suggest(uterms, spellings);
if (!spellings.empty()) {
chunk <<
trans("<p><i>Alternate spellings (accents suppressed): </i>");
for (vector<string>::iterator it = spellings.begin();
it != spellings.end(); it++) {
chunk << *it;
chunk << " ";
}
chunk << "</p>";
trans("<p><i>Alternate spellings (accents suppressed): </i>")
<< "<br /><blockquote>";
for (map<string, vector<string> >::const_iterator it0 =
spellings.begin(); it0 != spellings.end(); it0++) {
chunk << "<b>" << it0->first << "</b> : ";
for (vector<string>::const_iterator it =
it0->second.begin();
it != it0->second.end(); it++) {
chunk << *it << " ";
}
chunk << "<br />";
}
chunk << "</blockquote></p>";
}
}
} else {
+2 -1
View File
@@ -111,7 +111,8 @@ public:
virtual string prevUrl();
virtual string pageTop() {return string();}
virtual string iconUrl(RclConfig *, Rcl::Doc& doc);
virtual void suggest(const vector<string>, vector<string>&sugg) {
virtual void suggest(const vector<string>,
map<string, vector<string> >& sugg) {
sugg.clear();
}
virtual string absSep() {return "&hellip;";}