Skip to content
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

Merged
merged 1 commit into from
Dec 3, 2015
Merged

Conversation

codingwhatever
Copy link

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.

RegexSearchQuerySpec spec = new RegexSearchQuerySpec("(upfront|total_market)");

String json = jsonMapper.writeValueAsString(spec);
RegexSearchQuerySpec serdeQuery = jsonMapper.readValue(json, RegexSearchQuerySpec.class);
Copy link
Contributor

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);

)
{
this.pattern = pattern;
compiled = Pattern.compile(pattern);
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Author

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.

@fjy
Copy link
Contributor

fjy commented Dec 2, 2015

👍 @himanshug any more comments?

@himanshug
Copy link
Contributor

👍

@himanshug himanshug closed this Dec 3, 2015
@himanshug himanshug reopened this Dec 3, 2015
@himanshug
Copy link
Contributor

@codingwhatever pls squash your commits to make it mergeable .

@codingwhatever
Copy link
Author

@himanshug I have squashed the commits.

himanshug added a commit that referenced this pull request Dec 3, 2015
@himanshug himanshug merged commit 0eab841 into apache:master Dec 3, 2015
@fjy fjy modified the milestone: 0.9.0 Feb 4, 2016
@fjy fjy mentioned this pull request Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants