Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
String arguments should be able to check against Contains, Starts with, Ends with, not only Equals. Which would make it possible to create a simple search.
Here's the patch that worked for me.
Comment | File | Size | Author |
---|---|---|---|
#48 | 376932-views-extra-operator-1-D6.patch | 1.33 KB | kndr |
#43 | sort_by_alias.patch | 930 bytes | brettbirschbach |
#42 | break_phase.patch | 2.5 KB | brettbirschbach |
#36 | ScreenShot095.jpg | 70.61 KB | Pol |
#31 | views_extra_operator.zip | 10.37 KB | brettbirschbach |
Comments
Comment #1
dawehneri like the idea.
but your patch writes quite a bit thing other as the existing views_handler_filter_string.inc
There the same stuff is done also, so you could copy some code.
Additional there should be only indentation of two spaces,
anyway i like this idea
Comment #2
esmerel CreditAttribution: esmerel commentedNo additional work done on this in over a year.
Comment #3
PolPatch updated.
I've added:
I'll probably do the patch for Views 3.X in somedays.
Comment #4
PolComment #5
PolAnd this is the patch for Views 3.
Comment #6
xjmSee also #150248: Can $args & Argument Handling Code be Used to Limit Views to a Range or Series (as opposed to a single match)?. The patch here would form part of a solution for the string ranges case described in that issue.
Comment #7
PolI made a module out of it, you can download the latest version on this thread.
I'm planning to add support for numeric and dates soon.
Comment #8
abaddon CreditAttribution: abaddon commentedsaved code for posterity (same as above, removed extra __MACOS folder)
p.s. For security reasons, your upload has been renamed to views_extra_operator.tar_.gz.
Comment #9
PolUpdated version here with README, code comments and other stuff.
Comment #10
PolModule updated with new handlers.
I've added some other handlers but for an unknown reason, they are not included and I'm looking for help about this.
Comment #11
PolFixed some typos.
Comment #12
PolAdding support for Node:Nid and Integers.
Comment #13
PolBig update !
Now you can apply those operators to strings and integers:
Comment #14
PolScreenshots
Comment #15
PolCorrected some bugs, Drupal code compliant, files cleaning.
Comment #16
PolOops, I forgot to remove the _MACOSX folder!
Here is the tgz.
Comment #17
deleron CreditAttribution: deleron commentedNice job. I spend a couple hours to find something to do this without looking at the views code.
Comment #18
dagmarSorry but we don't review new modules in the views issue queue.
You can do two things,
Provide a Patch.
or
Apply for contributions CVS account and share your module in drupal.org
Comment #19
xjm#18: see patches in #3 and #5 for Views 2.x and 3.x respectively.
Comment #20
dagmarMmm, it seems you already apply to a cvs account, here #879118: Pol [pol], but I was marked as won't fix since you didn't follow the http://drupal.org/cvs-application/requirements
So, please read it, and do the thing in the right way.
Comment #21
dagmarMmm, cross post about the status, anyway patches provided in #3 and #5 uses tabs instead of spaces, and have some lines commented, it needs work.
Comment #22
PolOk I'll work this out by the end of the week and will be back soon ;)
Comment #23
cashbrown CreditAttribution: cashbrown commentedPol: Thank you for this, your timing could not be better. I was just about to crack open the code when I found this thread!
Comment #24
Pol@cashbrow, @deleron, @dagmar: I made a module, there is no need to patch the views code.
I've checked the code and it seems that it's drupal code compliant.
I hope it's ok, come back on me if it's not.
Comment #25
bojanz CreditAttribution: bojanz commentedI really think this is something we should have in Views proper, and not as an additional module.
Comment #26
dawehner#357082: Pull filter value from an argument? would allow this
Comment #27
BWPanda CreditAttribution: BWPanda commentedHere's the patch from #3 cleaned up. I applied it to my site and it works fine.
Comment #28
BWPanda CreditAttribution: BWPanda commentedOops, forgot to attach patch :)
Comment #29
martysteer CreditAttribution: martysteer commentedThe patch in #28 is great... but now that I've applied it, and altered my arguments to 'starts with' my views are returning all values. I also had the strange behaviour where some newly altered arguments went missing. I'll see if this is repeatable.
Comment #31
brettbirschbach CreditAttribution: brettbirschbach commentedI pulled the package created by Pol in #15, but it only worked for string fields that were not part of "Content" types - i.e. I could not use it with fields that I created using CCK.
I have updated the code to work for string "Content" fields. Attached is an updated package.
Comment #32
PolCool, that's really interesting !
It was something I was planning to do those days :-)
Comment #33
brettbirschbach CreditAttribution: brettbirschbach commentedPol, if you have some time, perhaps you can get the numeric arguments working as well, taking a similar approach to how I did the string args.
Should really get a "dev" version of this plugin into CVS - not sure how that even happens, but a plugin like this seems like something that a lot of people would find useful.
Comment #34
PolOk I'll do it, it's gonna be ready for tomorrow probably.
Comment #35
PolThe module for D6/Views 2.x/3.x is on Github for now at this address: https://github.com/Polzme/views_extra_operator
I'll add some new features in the next days probably, i've got my head full of new ideas!
Comment #36
PolAdded some new functions, screenshot updated.
Comment #37
byue CreditAttribution: byue commentedReturn blank screen when views with this module enabled is in panels.
Comment #38
byue CreditAttribution: byue commentedReturn blank screen when views with this module enabled is in panels.
Comment #39
PolI'll check next week. Do you have any error in the Status Report or in PHP logs ?
Which version have you tried ?
Try this one: https://github.com/Polzme/views_extra_operator that's the latest.
Comment #40
brettbirschbach CreditAttribution: brettbirschbach commentedPol,
Correct me if I'm wrong, but it seems that your module breaks the 'break_phrase' option in Views 2. The 'break_phrase' option is the option labeled "Allow multiple terms per argument." on the Views UI. With your module enabled, this option seems to be totally ignored, preventing me from querying an object based on multiple values (i.e. WHERE my_val IN ('val1', 'val2', 'val3')
Comment #41
brettbirschbach CreditAttribution: brettbirschbach commentedIn addition, all arguments are being treated as strings. i.e. when selecting on nid, which is a number, the resulting query is "WHERE nid = '123'" instead of "WHERE nid = 123". Maybe MySQL handles this w/no inefficiency at all, but my concern would be that using a string instead of a number when the column in the DB is a number could potentially degrade performance by not using an index.
Comment #42
brettbirschbach CreditAttribution: brettbirschbach commentedAttaching a patch for the "Allow multiple terms per argument." option on the Views UI to work once again. This isn't really meant to be an end-all solution, but is sufficient for my needs, and may give some direction on how to correctly implement.
Comment #43
brettbirschbach CreditAttribution: brettbirschbach commentedCame across another bug - this time with the sort_by clause. This patch fixes an issue where the sort by field was not being correctly prefixed. i.e. I was getting "ORDER BY title" instead of "ORDER BY node_title", which was causing SQL errors due to field ambiguity.
Comment #44
PolHello @HitmanInWis,
I've committed your patches, thanks !
Find the latest version here: https://github.com/Polzme/views_extra_operator
Comment #45
brettbirschbach CreditAttribution: brettbirschbach commentedPol,
In one of your recent revisions, it seems you changed how the selected argument type is specified in code behind the scenes - i.e. the default "op_equals" from CCK/Views is no longer interchangeable with your Equals value. What this results in is that if I have a bunch of views using the default CCK/Views op_equals value for arguments, and then I enable your module (views_extra_operator), all of my views using the old op_equals are broken until I go to each of the arguments in each of the views and re-save. I would strongly suggest working around that issue - otherwise many people may immediately stop using your module when they enable it and it seemingly breaks all of their existing views.
Just a suggestion. Thanks for your hard work on this Pol.
Comment #46
PolTrue, I'll sort this out tonight from home :-)
Thanks for reporting this.
Comment #47
PolVoila: https://github.com/Polzme/views_extra_operator/commit/3e7fd45edc2e177604...
This is the fix I did, if you have a better suggestion, just let me know.
Comment #48
kndrGreat work, Pol. Thanks! Your module is very usefull but I've found the bug in a sort handler. #43 doesn't work for me for simple fields (with no veo function). I've attached the patch for latest version at https://github.com/Polzme/views_extra_operator. Now it works for me. BTW - is $this->sort_field used anywhere?
Comment #49
PolHello Kndr,
I've committed your patch, thanks :-) Let me know if everything works now.
Comment #50
kndrEverything is OK. Thank you.
Comment #51
dawehnerI'm wondering whether you can create a project on drupal.org and use the issue queue there?
Then everyone would profit from it.
Comment #52
PolHi all,
I removed master branch and created 2 branches.
I've also updated the code to get it working with Views 3, I'm waiting for your feedback.
@Dereine: I do not put the code on D.O. because I don't have access to git at work and I cannot commit changes. As soon as we will be able to commit through https, I'll switch.
Comment #53
pvasili CreditAttribution: pvasili commentedPol, big thanks for your module. I think it should be added to the core views!
Comment #54
tnfno CreditAttribution: tnfno commentedThis module looks awesome, have tried to accomplish this before but ended up with a simple module with custom SQL instead of views. I have installed the module on Drupal 6.26 with Views 6.x-3.0+76-dev, but it looks like the argument settings are not saved, they revert to default value for both SQL Function and Parameters. No errors or warnings.
Any ideas ?
Comment #55
andypostSuppose it makes a lot of sense, views could be used for autocomplete tasks in core
Comment #56
knigh7 CreditAttribution: knigh7 commentedthis should move to views core, thanks :)
Comment #57
andypostCurrent head is 8
Comment #58
pvasili CreditAttribution: pvasili commented2 Pol, Your module now is not compatible with new Views 7-36 :(
Comment #59
PolHi,
I didn't know that it was still used!
Anyway, I'm quite busy with OpenLayers and I don't have time to put into this module unfortunately.
Thanks.
Comment #60
dawehnerThe patch in #48 seems to be very hardcoded, so I don't think this is core-worthy.
Comment #61
RgnYLDZ CreditAttribution: RgnYLDZ commentedIs there a similar module to do this. I'm searching for this for 1 week now. I have a big project and it depends on search for tags to be an exact match as in node.
Like, if I search for tags "a,b and c" I want to see the nodes only containing "a,b and c", or less. "a,c" or "b,c". Not "a,b,c,d,e"
Comment #62
andypostMaybe better to move this core, there's some sprints happens so bring this to radar
Comment #75
LendudeAs far as I can tell, this functionality now already is available in core, so closing as outdated. If you feel that there is still something we should address, please feel free to reopen this