vasanthv/jsonbox

[Suggestion] Change query syntax

freearhey opened this issue · 6 comments

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

Thanks for the suggestion. Will surely look into this.

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

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

@vasanthv here is what I found:

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

@vasanthv great news! and thanks for your work!