This project does not require DB.
How to set up:
gem install bundler
(if bundler is not installed)bundle install.
- Enjoy it
P.S. If you are running it on production, please don't forget to run assets precompile & set such ENV variables as
SECRET_KEY_BASE
SECRET_API_TOKEN
To create maintainable solution we use pipe, which have next parts:
- grammar
- parser, who generate abstract syntax tree (AST)
- query builder
- engine
Here we can define basic operations and terms for our AST. We inject it, so we can use different grammars for different searches.
Parser parse user input according to grammar and generate AST. I used treetop as a dependency, but for other cases it might be useful to have the ability to switch on the fly, so we can do it.
We can generate a search query for any engine we want (Solr, Sphinx, Elasticsearch, SQL query, etc). In my implementation I generated just dummy hash for in_memory engine.
Own engine for filtering/search/ranking or wrapper for existing one (Solr, Sphinx, Elasticsearch, SQL query).
- Improve spec coverage
- Optimize search logic
- Add more grammars/parsers/engines