sort and uniquify termMatch results out of stem expansion
This commit is contained in:
parent
bff0cf70be
commit
68b25b750c
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.104 2007-01-25 15:47:23 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.105 2007-02-02 10:10:53 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1410,10 +1410,12 @@ bool Db::termMatch(MatchType typ, const string &lang,
|
||||
if (typ == ET_STEM) {
|
||||
if (!stemExpand(lang, root, res, max))
|
||||
return false;
|
||||
res.sort();
|
||||
res.unique();
|
||||
for (list<TermMatchEntry>::iterator it = res.begin();
|
||||
it != res.end(); it++) {
|
||||
it->wcf = db.get_collection_freq(it->term);
|
||||
LOGDEB(("termMatch: %d [%s]\n", it->wcf, it->term.c_str()));
|
||||
LOGDEB1(("termMatch: %d [%s]\n", it->wcf, it->term.c_str()));
|
||||
}
|
||||
} else {
|
||||
regex_t reg;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef _DB_H_INCLUDED_
|
||||
#define _DB_H_INCLUDED_
|
||||
/* @(#$Id: rcldb.h,v 1.45 2006-12-19 12:11:21 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: rcldb.h,v 1.46 2007-02-02 10:10:53 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
@ -59,6 +59,8 @@ public:
|
||||
TermMatchEntry() : wcf(0) {}
|
||||
TermMatchEntry(const string&t, int f) : term(t), wcf(f) {}
|
||||
TermMatchEntry(const string&t) : term(t), wcf(0) {}
|
||||
bool operator==(const TermMatchEntry &o) { return term == o.term;}
|
||||
bool operator<(const TermMatchEntry &o) { return term < o.term;}
|
||||
string term;
|
||||
int wcf; // Within collection frequency
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user