[openstreetmap/openstreetmap-website] Add date range parameters to notes index API call (PR #3605)

Anton Khorev notifications at github.com
Tue Jul 19 14:52:45 UTC 2022


Make [index (bounding box) notes API call](https://wiki.openstreetmap.org/wiki/API_v0.6#Retrieving_notes_data_by_bounding_box:_GET_/api/0.6/notes) be able to receive `from` and `to` parameters similar to [search call](https://wiki.openstreetmap.org/wiki/API_v0.6#Search_for_notes:_GET_/api/0.6/notes/search).

## Use case

With date range parameters you can request more notes by excluding the already received ones. Let's say the limit was 100, you requested notes for some bbox and got 100 notes with most recent update dates. Now you know there might be more notes inside this bbox and you want to get another portion. You could increase the limit but then you'd have to redownload the notes you already received. With date range parameters you can set the upper limit* to the update date** of the last note you received and repeat the request. This way you'll skip redownloading most of the notes.

\* You also have to set the lower limit, see below.

\** Of course it would help to know the true update date: #3578.

## Details

The logic when `from`/`to` parameters present is the same as in search queries, even though I find it strange. `from` parameter is *required* for range check, but `to` is not. `to` alone is silently ignored.

Is there going to be a performance impact when a date range check is added to bbox query? Maybe not because the query already sorts notes by update_date.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/3605

-- Commit Summary --

  * Move date range code into its own method
  * Add date range condition to notes index

-- File Changes --

    M app/controllers/api/notes_controller.rb (51)
    M test/controllers/api/notes_controller_test.rb (34)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/3605.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3605.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3605
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3605 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220719/5f44ea31/attachment.htm>


More information about the rails-dev mailing list