Marking this critical since it goes against what I view as the intended design of the module and renders certain aspects of the module to "seem" broken.
This issue has been a bit of a ghost with no one really able to explain what was going on in a logical way.
Here are the details... Doing the following
Steps to recreate the scenario
- Create a new view of type "Node"
- Add an "in between" filter for a numerical value
- Expose the filter, give the filter a logical "min" and "max" range, and set it to "Optional" and "Remember".
- Add a page display
- Save your view
Experiencing the issue
- Browse to your view and note what nodes are showing (if any)
- Now clear any of the set min/max values and click apply on the filter
* note the discrepancies between the normal page and the "filtered" list
Explanation
So, this essentially shows that the fields are not "optional." They are required to be between the two min/max values. Suggestion, don't automatically fill the session with these values upon hitting the page display. It is counter-intuitive since their may be nodes that don't contain these values. Another option would be a simple flag to turn the option to "populate the min/max fields with their min/max values" and then not setting it in the session either, unless the user inputs it and submits of course.
I certainly hope this is clear. Please let me know if you have any questions regarding this.
Comments
Comment #1
nicholas.alipaz commentedchange title
Comment #2
esmerel commentedI'm unable to replicate this with 3.x - it behaves exactly as I would expect. When values are removed from the optional filter boxes, ALL nodes then are present.
In 2.x, the minimum and maximum value are always affecting the output. Are you sure you have the right version listed in your report?
Comment #3
nicholas.alipaz commentedesmerel, thanks for testing. I am sure of the version number.... But will do some more testing on a vanilla installation when I have a chance. I just got through "hacking/fixing" a solution that would allow it to work on my site. For what it's worth, here is the code that I ended up using to make it work on my site:
Comment #4
nicholas.alipaz commentedBy the way, I think the issue stems mostly from when a field does not contain any data, but it is filterable as "in between". They only show when the value is set to nothing.
I will assign it back to you just so you can comment on this part if you have any input on that. So if you test be sure to have a node with a field that has no value in it, you will find it doesn't show in the results until you hit apply for your filter.
Comment #5
esmerel commentedI've managed to confirm that it behaves differently between 2.x and 3.x, so I'm going to have to show [merlinofchaos] and let him read the code and figure out what way it's supposed to be working :)
I was using nid, because it always has a value, since that was easier than creating my own field and populating a bunch of stuff. :) I wouldn't expect a field with no data to ever show in an 'in between', only if there's no filter present.
Comment #6
esmerel commentedMay be a duplicate of #856238: exposed filter of created date with "Is between" and optional returns empty results
Comment #7
nicholas.alipaz commentedOr perhaps that one is a duplicate of this?
Comment #8
merlinofchaos commentedThat one has a patch, so let's mark this the duplicate.