Skip to content

Commit 0e654e1

Browse files
committed
WIP
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent ff4f09c commit 0e654e1

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

src/services/PhotoSearch.js

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,43 @@ export default async function(path = '', options = {}) {
100100
let timeWindow = ''
101101
if (options.dateTimeUpperBound !== undefined) {
102102
timeWindow = `
103-
<d:lt>
104-
<d:prop>
105-
<nc:metadata-photos-original_date_time/>
106-
</d:prop>
107-
<d:literal>${options.dateTimeUpperBound}</d:literal>
108-
</d:lt>`
103+
<d:or>
104+
<d:lte>
105+
<d:prop><nc:metadata-photos-original_date_time/></d:prop>
106+
<d:literal>${options.dateTimeUpperBound}</d:literal>
107+
</d:lte>
108+
<d:and>
109+
<d:not>
110+
<d:is-defined>
111+
<d:prop><nc:metadata-photos-original_date_time/></d:prop>
112+
</d:is-defined>
113+
</d:not>
114+
<d:lte>
115+
<d:prop><d:getlastmodified/></d:prop>
116+
<d:literal>${options.dateTimeUpperBound}</d:literal>
117+
</d:lte>
118+
</d:and>
119+
</d:or>`
109120
}
110121
if (options.dateTimeLowerBound !== undefined) {
111122
timeWindow += `
112-
<d:gt>
113-
<d:prop>
114-
<nc:metadata-photos-original_date_time/>
115-
</d:prop>
116-
<d:literal>${options.dateTimeLowerBound}</d:literal>
117-
</d:gt>`
123+
<d:or>
124+
<d:gt>
125+
<d:prop><nc:metadata-photos-original_date_time/></d:prop>
126+
<d:literal>${options.dateTimeLowerBound}</d:literal>
127+
</d:gt>
128+
<d:and>
129+
<d:not>
130+
<d:is-defined>
131+
<d:prop><nc:metadata-photos-original_date_time/></d:prop>
132+
</d:is-defined>
133+
</d:not>
134+
<d:gt>
135+
<d:prop><d:getlastmodified/></d:prop>
136+
<d:literal>${options.dateTimeLowerBound}</d:literal>
137+
</d:gt>
138+
</d:and>
139+
</d:or>`
118140
}
119141

120142
options = Object.assign({

0 commit comments

Comments
 (0)