bool do_match(const item &n) { if (m_field.size()) { string fv; if (m_field == "tags") { item t; t.tags(m_value); auto tt = t.split_tags(); auto tags = n.split_tags(); if (m_exact) return tt == tags; for (auto it = tt.begin(); it != tt.end(); ++it) { if (!tags.count(*it)) return false; } return true; } if (m_field == "username") fv = n.username(); if (m_field == "url") fv = n.url(); if (m_field == "notes") fv = n.notes(); if (m_exact) return fv == m_value; if (m_prefix) return fv.size() >= m_value.size() && fv.substr(0, m_value.size()) == m_value; return fv.find(m_value) != string::npos; } return n.username().find(m_value) != string::npos || n.url().find(m_value) != string::npos || n.tags().find(m_value) != string::npos || n.notes().find(m_value) != string::npos; }