Switch to unified view

a/src/rcldb/rcldb.h b/src/rcldb/rcldb.h
...
...
131
    size_t       maxdoclen;
131
    size_t       maxdoclen;
132
};
132
};
133
133
134
inline bool has_prefix(const string& trm)
134
inline bool has_prefix(const string& trm)
135
{
135
{
136
#ifndef RCL_INDEX_STRIPCHARS
137
    if (o_index_stripchars) {
136
    if (o_index_stripchars) {
138
#endif
139
    return !trm.empty() && 'A' <= trm[0] && trm[0] <= 'Z';
137
    return !trm.empty() && 'A' <= trm[0] && trm[0] <= 'Z';
140
#ifndef RCL_INDEX_STRIPCHARS
141
    } else {
138
    } else {
142
    return !trm.empty() && trm[0] == ':';
139
    return !trm.empty() && trm[0] == ':';
143
    }
140
    }
144
#endif
145
}
141
}
146
142
147
inline string strip_prefix(const string& trm)
143
inline string strip_prefix(const string& trm)
148
{
144
{
149
    if (trm.empty())
145
    if (trm.empty())
150
    return trm;
146
    return trm;
151
    string::size_type st = 0;
147
    string::size_type st = 0;
152
#ifndef RCL_INDEX_STRIPCHARS
153
    if (o_index_stripchars) {
148
    if (o_index_stripchars) {
154
#endif
155
    st = trm.find_first_not_of("ABCDEFIJKLMNOPQRSTUVWXYZ");
149
    st = trm.find_first_not_of("ABCDEFIJKLMNOPQRSTUVWXYZ");
156
    if (st == string::npos)
150
    if (st == string::npos)
157
        return string();
151
        return string();
158
#ifndef RCL_INDEX_STRIPCHARS
159
    } else {
152
    } else {
160
    if (has_prefix(trm)) {
153
    if (has_prefix(trm)) {
161
        st = trm.find_last_of(":") + 1;
154
        st = trm.find_last_of(":") + 1;
162
    } else {
155
    } else {
163
        return trm;
156
        return trm;
164
    }
157
    }
165
    }
158
    }
166
#endif
167
    return trm.substr(st);
159
    return trm.substr(st);
168
}
160
}
169
161
170
inline string wrap_prefix(const string& pfx) 
162
inline string wrap_prefix(const string& pfx) 
171
{
163
{
172
#ifndef RCL_INDEX_STRIPCHARS
173
    if (o_index_stripchars) {
164
    if (o_index_stripchars) {
174
#endif
175
    return pfx;
165
    return pfx;
176
#ifndef RCL_INDEX_STRIPCHARS
177
    } else {
166
    } else {
178
    return cstr_colon + pfx + cstr_colon;
167
    return cstr_colon + pfx + cstr_colon;
179
    }
168
    }
180
#endif
181
}
169
}
182
170
183
/**
171
/**
184
 * Wrapper class for the native database.
172
 * Wrapper class for the native database.
185
 */
173
 */
...
...
460
extern const string pathelt_prefix;
448
extern const string pathelt_prefix;
461
extern const string udi_prefix;
449
extern const string udi_prefix;
462
extern const string parent_prefix;
450
extern const string parent_prefix;
463
extern const string mimetype_prefix;
451
extern const string mimetype_prefix;
464
extern const string unsplitFilenameFieldName;
452
extern const string unsplitFilenameFieldName;
465
#ifdef RCL_INDEX_STRIPCHARS
466
extern const string start_of_field_term;
467
extern const string end_of_field_term;
468
#else
469
extern string start_of_field_term;
453
extern string start_of_field_term;
470
extern string end_of_field_term;
454
extern string end_of_field_term;
471
#endif
455
472
}
456
}
473
457
474
#endif /* _DB_H_INCLUDED_ */
458
#endif /* _DB_H_INCLUDED_ */