-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex search query #2008
Regex search query #2008
Conversation
RegexSearchQuerySpec spec = new RegexSearchQuerySpec("(upfront|total_market)"); | ||
|
||
String json = jsonMapper.writeValueAsString(spec); | ||
RegexSearchQuerySpec serdeQuery = jsonMapper.readValue(json, RegexSearchQuerySpec.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u change to
(RegexSearchQuerySpec) jsonMapper.readValue(json, SearchQuerySpec.class);
d536a9e
to
807e52d
Compare
) | ||
{ | ||
this.pattern = pattern; | ||
compiled = Pattern.compile(pattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this fail if pattern was null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can throw an exception in case the pattern in null and document pattern as a required value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preconditions notnull with a hint to pattern
is the typical workflow for things such as this. It helps debug on querying side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I added the precondition and removed all the null checks.
👍 @himanshug any more comments? |
👍 |
@codingwhatever pls squash your commits to make it mergeable . |
134d6ed
to
596b7eb
Compare
@himanshug I have squashed the commits. |
This PR adds a SearchQuerySpec that supports searching for a regex. It uses the same regex pattern match as the RegexFilter.
I will be adding documentation shortly.