Reputation: 3752
Does anyone have a regex that can be used to validate that a query to be sent to lucene is is well formatted?
Upvotes: 0
Views: 5092
Reputation: 295
I've created a js AMD module here: https://github.com/grahamscott/lucene-validator-amd-module
It's based on the praized module above, but is easier to integrate client-side, and doesn't rely on window.alert()
Upvotes: 1
Reputation: 96
https://github.com/praized/lucene-query-validator/blob/master/src/luceneQueryValidator.js
This is a JavaScript attempt. I have not verified it's success but from reviewing the code, everything looks legit.
If you're allowing your users to enter in free text, there is always the chance that they'll mistype a field name (i.e. naem:Bob instead of name:Bob ). This validator will not catch issues like that.
Upvotes: 2