From f400cee1d5896577c22626d0cf50478057989857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Nicole?= Date: Mon, 28 May 2018 10:08:49 +0200 Subject: Implement ranged queries Summary: Notes: - For now, only for QDateTime indexes - Invalid QDateTimes are stored in the index (subject to change) - Should be a drop-in replacement from ValueIndexes (except for `In` and `Contains` queries) Reviewers: cmollekopf Tags: #sink Differential Revision: https://phabricator.kde.org/D13105 --- common/domain/typeimplementations.cpp | 5 +++-- common/domain/typeimplementations_p.h | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'common/domain') diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp index e65c998..a8f4baf 100644 --- a/common/domain/typeimplementations.cpp +++ b/common/domain/typeimplementations.cpp @@ -38,7 +38,7 @@ using namespace Sink::ApplicationDomain; MAPPER.addMapping(&Sink::ApplicationDomain::Buffer::ENTITYTYPE::LOWERCASEPROPERTY, &Sink::ApplicationDomain::Buffer::ENTITYTYPE##Builder::add_##LOWERCASEPROPERTY); typedef IndexConfig, + SortedIndex, ValueIndex, ValueIndex, ValueIndex, @@ -64,7 +64,8 @@ typedef IndexConfig AddressbookIndexConfig; typedef IndexConfig + ValueIndex, + SortedIndex > EventIndexConfig; typedef IndexConfig +template class SortedIndex { public: @@ -78,6 +78,22 @@ public: } }; +template +class SortedIndex +{ +public: + static void configure(TypeIndex &index) + { + index.addSortedProperty(); + } + + template + static QMap databases() + { + return {{QByteArray{EntityType::name} +".index." + SortProperty::name + ".sorted", 1}}; + } +}; + template class SecondaryIndex { -- cgit v1.2.3