Hacker News new | ask | show | jobs
by mikeshi42 998 days ago
This one is a fun one that I've spent too many nights on - we're largely similar to Google-style search syntax (bare terms, "OR" "AND" logical operators, and property:value kind of search).

We include a "query explainer" - which translates the parsed query AST into something more human readable under the search bar, hopefully giving good feedback to the user on whether we're understand their query or not. Though there's lots of room to improve here!

1 comments

Potentially useful resource – https://github.com/gajus/liqe
I've tried liqe! I really wanted to love it - and I think it's amazing for the use case you've built it for, but I recall we ran into a few fatal issues (maybe it was supporting URLs or something as a property value?) and had to fork one of the `lucene` forks to get the grammar that we wanted.

Edit: happy to chat more about it as well if you're looking for more specific feedback - it's an area I've spent a decent amount of time on and would love to improve projects like liqe or others based on our experience if we can.

Antlr is pretty robust too, might be worth checking out.

https://www.antlr.org/

Ah TIL - I haven't heard of them but looks like they're pretty well loved. We haven't had any issues with PEG.js (the lib/grammar behind our current parser) but will definitely keep antlr in mind if we run into issues for some reason (since PEG doesn't look well maintained anymore unfortunately)