Software /
code /
prosody-modules
Comparison
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 |
parent | 3491:4e9d4b07e3e9 |
child | 3572:7700c9537e90 |
comparison
equal
deleted
inserted
replaced
3570:8a93af85f319 | 3571:f5ea0b886c7c |
---|---|
108 local count = 0; | 108 local count = 0; |
109 local rev = query.reverse; | 109 local rev = query.reverse; |
110 if query.start then | 110 if query.start then |
111 local d = dt.date(query.start); | 111 local d = dt.date(query.start); |
112 for i = 1, #dates do | 112 for i = 1, #dates do |
113 if dates[i] == d then | 113 if dates[i] >= d then |
114 start_day = i; break; | 114 start_day = i; break; |
115 end | 115 end |
116 end | 116 end |
117 end | 117 end |
118 if query["end"] then | 118 if query["end"] then |
119 local d = dt.date(query["end"]); | 119 local d = dt.date(query["end"]); |
120 for i = #dates, 1, -1 do | 120 for i = #dates, 1, -1 do |
121 if dates[i] == d then | 121 if dates[i] <= d then |
122 last_day = i; break; | 122 last_day = i; break; |
123 end | 123 end |
124 end | 124 end |
125 end | 125 end |
126 local items; | 126 local items; |