vasanthv / jsonbox

HTTP-based JSON storage.
https://jsonbox.io
MIT License
2.49k stars 173 forks source link

[Suggestion] Change query syntax #4

Closed freearhey closed 5 years ago

freearhey commented 5 years ago

I wanted to suggest replacing the current query syntax with a simpler one, the same as GitHub uses in its search queries. Here is a small example of how this might look:

# exact match
https://jsonbox.io/demobox_6d9e326c183fde7b?q=arya%20stark

# query with AND operator
https://jsonbox.io/demobox_6d9e326c183fde7b?q=dogs+cats

# query with OR operator
https://jsonbox.io/demobox_6d9e326c183fde7b?q=dogs|cats

# exact match with field name
https://jsonbox.io/demobox_6d9e326c183fde7b?q=name:arya%20stark

# exact match by multiple fields
https://jsonbox.io/demobox_6d9e326c183fde7b?q=name:arya%20stark+age:23

# greater than
https://jsonbox.io/demobox_6d9e326c183fde7b?q=likes:>100

# equal or greater than
https://jsonbox.io/demobox_6d9e326c183fde7b?q=stars:>=1000

# less than
https://jsonbox.io/demobox_6d9e326c183fde7b?q=posts:<100

# equal or less than
https://jsonbox.io/demobox_6d9e326c183fde7b?q=_createdOn:<=2019-09-10T09:23:01.105Z

You can find a few more examples from these links: https://developer.github.com/v3/search/ https://help.github.com/en/articles/understanding-the-search-syntax

vasanthv commented 5 years ago

Thanks for the suggestion. Will surely look into this.

vasanthv commented 5 years ago

@freearhey have you come across a parser for this queries?

freearhey commented 5 years ago

@vasanthv not yet, but later I'll try again.

freearhey commented 5 years ago

@vasanthv here is what I found:

vasanthv commented 5 years ago

Added support for filtering on multiple fields. https://github.com/vasanthv/jsonbox#filtering

freearhey commented 5 years ago

@vasanthv great news! and thanks for your work!