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

Add multi-field search support to value filter. #161

Merged
merged 2 commits into from Apr 26, 2017

Conversation

ndm2
Copy link
Contributor

@ndm2 ndm2 commented Apr 25, 2017

Basically a copy of #135, but complete with tests.

However, I've just noticed that having a mode for the values doesn't seem to make any sense, given that this filter applies an EQ comparison, applying AND to multiple values would never match, as a field can only hold one of the values in such a comparison.

Am I missing something, or did I just made a mistake when I added this initially, and nobody noticed it?

@codecov
Copy link

codecov bot commented Apr 25, 2017

Codecov Report

Merging #161 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #161   +/-   ##
=========================================
  Coverage     99.68%   99.68%           
+ Complexity      140      138    -2     
=========================================
  Files            11       11           
  Lines           321      321           
=========================================
  Hits            320      320           
  Misses            1        1
Impacted Files Coverage Δ Complexity Δ
src/Model/Filter/Value.php 100% <100%> (ø) 10 <2> (-2) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88e4dd3...3ba9321. Read the comment docs.

@ADmad
Copy link
Member

ADmad commented Apr 25, 2017

However, I've just noticed that having a mode for the values doesn't seem to make any sense, given that this filter applies an EQ comparison, applying AND to multiple values would never match, as a field can only hold one of the values in such a comparison.

You are right, using AND for multiple values doesn't make sense, it would never match. Seems we did over look that.

@dereuromark
Copy link
Member

Yes, it only makes sense for the field part.

@ndm2
Copy link
Contributor Author

ndm2 commented Apr 25, 2017

Given that it would be kind of a bug fix, would you be OK with a "hard break" in terms of removing that feature/option, ie only use IN() for multiple values?

@dereuromark
Copy link
Member

dereuromark commented Apr 25, 2017

Lets ship it together with #156 as major bump. All good then.

@ADmad
Copy link
Member

ADmad commented Apr 25, 2017

I don't think we are breaking anything as 'mode' => 'AND' would have never "worked" in the first place.

@ndm2
Copy link
Contributor Author

ndm2 commented Apr 25, 2017

That would be my stance on it too, just wanted to ask as people have different opinions when it comes to removing not-correctly/non working, but possibly in use behavior. I'll remove it.

{
$articles = TableRegistry::get('Articles');
$manager = new Manager($articles);
$filter = new Value('title', $manager, [
'multiValue' => true,
'mode' => 'Or'
'valueMode' => 'Or'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above you used "mode".

This never worked, as a single field can only ever hold one of the
supplied values, hence using `AND` would never match anything.

`mode` is now being used for defining the mode for multiple fields
instead.
@ndm2 ndm2 force-pushed the multi-field-search-support branch from 62c6a30 to 3ba9321 Compare April 25, 2017 15:15
@dereuromark dereuromark merged commit 9ed0e68 into FriendsOfCake:master Apr 26, 2017
@dereuromark
Copy link
Member

@ADmad Do you want to tag a new minor before we merge and release the new major change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants