From 00717f6c8b8a9c6dbd56a80d685c5082fc03f6a5 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 25 May 2018 11:28:22 +0200 Subject: Implement range queries --- common/query.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'common/query.cpp') diff --git a/common/query.cpp b/common/query.cpp index 5f6d095..404a304 100644 --- a/common/query.cpp +++ b/common/query.cpp @@ -132,8 +132,8 @@ bool QueryBase::Filter::operator==(const QueryBase::Filter &other) const bool QueryBase::operator==(const QueryBase &other) const { - auto ret = mType == other.mType - && mSortProperty == other.mSortProperty + auto ret = mType == other.mType + && mSortProperty == other.mSortProperty && mBaseFilterStage == other.mBaseFilterStage; return ret; } @@ -171,6 +171,14 @@ bool QueryBase::Comparator::matches(const QVariant &v) const return false; } return value.value().contains(v.toByteArray()); + case Within: { + auto range = value.value>(); + if (range.size() < 2) { + return false; + } + + return range[0] <= v && v <= range[1]; + } case Fulltext: case Invalid: default: -- cgit v1.2.3