Which is obviously not JSON, YAML or SQL.
I recently did this for https://learn-unicode.now.sh, which does come from this topic.
Article No Longer Available
The solution is inspired from lunr.js which for some reasons, support searching by field; but is rare in other search engines. Also, for some reasons, lunr.js, by default, join the fields with OR, instead of AND, which is unintuitive.
patarapolw / qsearch
Search a database with a string. Designed for end-users.
Generating JSON for usage in search in NoSQL's is relatively easy, tested for MongoDB, LokiJS, NeDB and Array.prototype.filter
. I also noticed some differences.
LokiJS doesn't allow
{
'data.a': { $regex: /b/i }
}
Or its equivalent data.a:b
.
Joining with AND or OR, and allow quotes is not as complex as it seems, due to shlex and /^[-+?]/
prefixes. However, I don't allow brackets this time, because it would get complex. I have tried to do it before, though.
If you are kind, I am looking for library testers. See if you can break it.
Top comments (0)