Siel

Siel

Custom parsing of a search query

Greetings everyone!

I’ve been working on some projects, one of them is going to be an open source platform for researchers to share pharmacokinetic data. The basics of the platform are done, now I’m thinking about the search mechanism.

I would like to write a system that enable researchers to compose queries, something like this. In that web a search string like this year>1998 year<2020 c:r t:cat or t:fish name:"Hippo" would give us this.

I was going to start writing something like that for my project, but then I realized that I might not been the first person with this kind of problem. That’s why I’m here, Do any of you know some library or pattern that would help me to implement this?

I did a basic search over internet and my results were scarce. Right now I think that it’s very specific and I would need to implement it by myself :sweat_smile:

Thanks!

Most Liked

Vesuvium

Vesuvium

The only solution that comes to my mind is to implement a DSL using PEG, LALR or similar.




http://erlang.org/doc/man/yecc.html

chasers

chasers

We use nimble_parsec. You can take a look at what we’ve done with our parser. We’ve got a fairly robust query language for searching through structured logs.

You can do something like (this is on the staging branch to roll out to prod this week):

Note: while not open source I wanted to keep Logflare public for some more complete Elixir examples. Hopefully this is helpful.

Siel

Siel

@Vesuvium and @chasers the resources provided are very helpful indeed.

Thank you very much!

Where Next?

Popular in Questions Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement