From 7cb714b57d1cbebb572e2279e2058f5fc94ba171 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 16 Feb 2017 20:02:55 -0500 Subject: Added word::synonyms join field (BAD) Note that this is not a great implementation; the filter generated is mergable with unrelated filters and may cause results that are misleading. --- lib/word.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/word.cpp') diff --git a/lib/word.cpp b/lib/word.cpp index e4de187..dc269c9 100644 --- a/lib/word.cpp +++ b/lib/word.cpp @@ -38,6 +38,8 @@ namespace verbly { const field word::regionalTerms = field::selfJoin(object::word, "word_id", "regionality", "domain_id", "term_id"); const field word::regionalDomains = field::selfJoin(object::word, "word_id", "regionality", "term_id", "domain_id"); + const word::synonyms_field word::synonyms = {}; + field word::forms(inflection category) { return field::joinThroughWhere(object::word, "lemma_id", object::form, "lemmas_forms", "form_id", "category", static_cast(category)); @@ -168,4 +170,22 @@ namespace verbly { forms_[infl] = db_->forms(form::words(infl) %= *this, verbly::form::id, -1).all(); } + filter word::synonyms_field::operator%=(filter joinCondition) const + { + return (verbly::notion::words %= ( + std::move(joinCondition) + && (filter( + verbly::word::id, + filter::comparison::field_does_not_equal, + verbly::word::id)))); + } + + word::synonyms_field::operator filter() const + { + return (verbly::notion::words %= filter( + verbly::word::id, + filter::comparison::field_does_not_equal, + verbly::word::id)); + } + }; -- cgit 1.4.1