phrases: only allow for index fields

This commit is contained in:
djcb
2017-10-27 18:42:58 +03:00
parent fe18603843
commit 6ce7c89488
4 changed files with 16 additions and 6 deletions

View File

@ -104,11 +104,12 @@ struct Value: public Data {
* @param _value the value
*/
Value (const std::string& _field, const std::string& _prefix,
unsigned _id, const std::string& _value):
unsigned _id, const std::string& _value, bool _phrase = false):
Data(Value::Type::Value, _field, _prefix, _id),
value(_value) {}
value(_value), phrase(_phrase) {}
std::string value; /**< the value */
std::string value; /**< the value */
bool phrase;
};
@ -128,6 +129,9 @@ operator<< (std::ostream& os, const std::unique_ptr<Data>& v)
const auto bval = dynamic_cast<Value*> (v.get());
os << ' ' << quote(v->field) << ' '
<< quote(utf8_flatten(bval->value));
if (bval->phrase)
os << " (ph)";
break;
}
case Data::Type::Range: {