changeset 3571:f5ea0b886c7c

mod_storage_xmlarchive: Limit search to smallest time range in case of inexact match This should improve performance in case the exact days in the 'start' and 'end' range are missing from the index.
author Kim Alvefur <zash@zash.se>
date Fri, 03 May 2019 18:59:38 +0200
parents 8a93af85f319
children 7700c9537e90
files mod_storage_xmlarchive/mod_storage_xmlarchive.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Thu May 02 20:43:05 2019 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Fri May 03 18:59:38 2019 +0200
@@ -110,7 +110,7 @@
 	if query.start then
 		local d = dt.date(query.start);
 		for i = 1, #dates do
-			if dates[i] == d then
+			if dates[i] >= d then
 				start_day = i; break;
 			end
 		end
@@ -118,7 +118,7 @@
 	if query["end"] then
 		local d = dt.date(query["end"]);
 		for i = #dates, 1, -1 do
-			if dates[i] == d then
+			if dates[i] <= d then
 				last_day = i; break;
 			end
 		end