Coder Social home page Coder Social logo

Revisit API design [PL-API10] about pelias HOT 4 CLOSED

pelias avatar pelias commented on September 27, 2024
Revisit API design [PL-API10]

from pelias.

Comments (4)

riordan avatar riordan commented on September 27, 2024

same as #41

from pelias.

missinglink avatar missinglink commented on September 27, 2024

it would be nice to return the 'total matched results' despite the page length being set to 1-40, this is nice to have in order to derive a 'total pages' count and also for analytics, like 'how many mcdonalds in this bbox' (which is actually quite hard to do with other databases/engines)

eg.

  • page length: 40
  • results in this page: 40
  • total pages: 12
  • total results matched: 451

note: some of these values can be computed by the client and some can be returned from the server, the minimum the server should return is "total results" as the others can be inferred from the data and the query params/defaults.

from pelias.

riordan avatar riordan commented on September 27, 2024

+1 to @missinglink's suggestion

I think you've stubbed out what that would/should look like quite nicely and opens up some more questions like:

  • How would one paginate from those maximum number of results? Would they reformulate a query and ask for that total number of results?
  • Is that a fundamentally different kind of question from Geocoding? It's certainly a kind of question that our dataset should be capable of answering.
  • Would we be able to surface the match count without much of a performance impact?

from pelias.

missinglink avatar missinglink commented on September 27, 2024

we get the total count for free, no additional logic would be required outside the code to expose it in the API

from pelias.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.