Fork me on GitHub
#datomic
<
2021-05-17
>
Florin Braghis08:05:56

Hello ! I have a 3 questions about sorting. There is a fairly large collection of photos, each photo has a ‘photo/taken-at’ attribute with value type instant. I want to retrieve 100 photos ordered by taken-at potentially in reverse chronology. What is the idiomatic way to achieve that ? So far I’ve managed to do it using ‘index-pull’ which also has offset, limit and reverse options. Is this the way to do it ? Then, if I want to find a specific photo title in the oldest 100 photos, I would first retrieve the ids using index-pull, then perform a parameterized :find using those ids and the substring as parameters to the query. Alternatively, if I want to find the title in all photos, I first perform the query, then do a sort-by :taken-at on the results. So 3 questions really, but all related :). Is my thinking correct? Thank you !

pyry12:05:48

1. Can't claim to vouch for a huge user base, but I'd say that is indeed idiomatic. A good choice, at any rate.

pyry12:05:56

2. That should work. I guess you could also just add the photo title to the :selector and filter "by hand".

pyry12:05:22

3. Again, I think you could just add the photo title to the :selector instead?