diff mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 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 4e9d4b07e3e9
children 7700c9537e90
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