Add flag qualifying field to be indexed exclusively with prefix
This commit is contained in:
@@ -847,16 +847,19 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
|
||||
ft.wdfinc = atoi(tval.c_str());
|
||||
if (attrs.get("boost", tval))
|
||||
ft.boost = atof(tval.c_str());
|
||||
if (attrs.get("pfxonly", tval))
|
||||
ft.pfxonly = stringToBool(tval);
|
||||
m_fldtotraits[stringtolower(*it)] = ft;
|
||||
LOGDEB2(("readFieldsConfig: [%s] -> [%s] %d %.1f\n",
|
||||
it->c_str(), ft.pfx.c_str(), ft.wdfinc, ft.boost));
|
||||
}
|
||||
|
||||
// Add prefixes for aliases an build alias-to-canonic map while we're at it
|
||||
// Having the aliases in the prefix map avoids an additional indirection
|
||||
// at index time.
|
||||
// Add prefixes for aliases and build alias-to-canonic map while
|
||||
// we're at it. Having the aliases in the prefix map avoids an
|
||||
// additional indirection at index time.
|
||||
tps = m_fields->getNames("aliases");
|
||||
for (vector<string>::const_iterator it = tps.begin(); it != tps.end();it++) {
|
||||
for (vector<string>::const_iterator it = tps.begin();
|
||||
it != tps.end(); it++){
|
||||
string canonic = stringtolower(*it); // canonic name
|
||||
FieldTraits ft;
|
||||
map<string, FieldTraits>::const_iterator pit =
|
||||
|
||||
@@ -65,9 +65,11 @@ struct FieldTraits {
|
||||
string pfx; // indexing prefix,
|
||||
int wdfinc; // Index time term frequency increment (default 1)
|
||||
double boost; // Query time boost (default 1.0)
|
||||
FieldTraits(int i, double f) {wdfinc = i; boost = f;}
|
||||
FieldTraits() : wdfinc(1), boost(1.0) {}
|
||||
FieldTraits(const string& s) : pfx(s), wdfinc(1), boost(1.0) {}
|
||||
bool pfxonly; // Suppress prefix-less indexing
|
||||
|
||||
FieldTraits()
|
||||
: wdfinc(1), boost(1.0), pfxonly(false)
|
||||
{}
|
||||
};
|
||||
|
||||
class RclConfig {
|
||||
|
||||
Reference in New Issue
Block a user