Abstracts: improve the way we group terms for quality computation

This commit is contained in:
Jean-Francois Dockes
2012-10-03 11:17:16 +02:00
parent d3a26706b5
commit c589419267
5 changed files with 81 additions and 25 deletions
+6
View File
@@ -17,6 +17,12 @@ struct HighlightData {
*/
std::set<std::string> uterms;
/** The db query terms linked to the uterms entry they were expanded from.
* This is used for aggregating term stats when generating snippets (for
* choosing the best terms, allocating slots, etc. )
*/
std::map<std::string, std::string> terms;
/** The original user terms-or-groups. This is for display
* purposes: ie when creating a menu to look for a specific
* matched group inside a preview window. We want to show the
+7 -3
View File
@@ -1050,7 +1050,12 @@ void HighlightData::toString(std::string& out)
it != uterms.end(); it++) {
out.append(" [").append(*it).append("]");
}
out.append("\nUser terms to Query terms:");
for (map<string, string>::const_iterator it = terms.begin();
it != terms.end(); it++) {
out.append("[").append(it->first).append("]->[");
out.append(it->second).append("] ");
}
out.append("\nGroups: ");
char cbuf[200];
sprintf(cbuf, "Groups size %d grpsugidx size %d ugroups size %d",
@@ -1075,13 +1080,12 @@ void HighlightData::toString(std::string& out)
out.append("}").append(cbuf);
}
out.append("\n");
fprintf(stderr, "toString ok\n");
}
void HighlightData::append(const HighlightData& hl)
{
uterms.insert(hl.uterms.begin(), hl.uterms.end());
terms.insert(hl.terms.begin(), hl.terms.end());
size_t ugsz0 = ugroups.size();
ugroups.insert(ugroups.end(), hl.ugroups.begin(), hl.ugroups.end());