Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Needs review » Needs work

i 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

esmerel’s picture

Status: Needs work » Closed (won't fix)

No additional work done on this in over a year.

Pol’s picture

Version: 6.x-3.x-dev » 6.x-2.x-dev
Status: Needs review » Closed (won't fix)
FileSize
4.05 KB

Patch updated.

I've added:

  • Is equal to
  • Is not equal to
  • Start with
  • Does not start with
  • Ends with
  • Does not end with
  • Contains
  • Does not contain

I'll probably do the patch for Views 3.X in somedays.

Pol’s picture

Status: Closed (won't fix) » Needs review
Pol’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
FileSize
4.65 KB

And this is the patch for Views 3.

xjm’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Status: Closed (won't fix) » Needs review

See 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.

Pol’s picture

I 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.

abaddon’s picture

saved 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.

Pol’s picture

FileSize
3.08 KB

Updated version here with README, code comments and other stuff.

Pol’s picture

FileSize
3.75 KB

Module 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.

Pol’s picture

FileSize
3.71 KB

Fixed some typos.

Pol’s picture

FileSize
3.92 KB

Adding support for Node:Nid and Integers.

Pol’s picture

FileSize
4.76 KB

Big update !

Now you can apply those operators to strings and integers:

  • Is equal to
  • Is not equal to
  • Start with
  • Does not start with
  • Ends with
  • Does not end with
  • Contains
  • Does not contain
  • Contains any words
  • Contains all words
  • String length greater
  • String length greater or equal
  • String length lesser
  • String length lesser or equal
  • String length different
  • String length is between
  • String length is not between
Pol’s picture

Pol’s picture

FileSize
16.32 KB

Corrected some bugs, Drupal code compliant, files cleaning.

Pol’s picture

FileSize
4.59 KB

Oops, I forgot to remove the _MACOSX folder!

Here is the tgz.

deleron’s picture

Nice job. I spend a couple hours to find something to do this without looking at the views code.

dagmar’s picture

Status: Needs review » Needs work

Sorry 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

xjm’s picture

Status: Needs work » Needs review

#18: see patches in #3 and #5 for Views 2.x and 3.x respectively.

dagmar’s picture

Status: Needs review » Needs work

Mmm, 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.

dagmar’s picture

Mmm, 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.

Pol’s picture

Ok I'll work this out by the end of the week and will be back soon ;)

cashbrown’s picture

Pol: Thank you for this, your timing could not be better. I was just about to crack open the code when I found this thread!

Pol’s picture

@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.

bojanz’s picture

I really think this is something we should have in Views proper, and not as an additional module.

dawehner’s picture

BWPanda’s picture

Version: 6.x-3.x-dev » 6.x-2.x-dev
Status: Needs work » Needs review

Here's the patch from #3 cleaned up. I applied it to my site and it works fine.

BWPanda’s picture

FileSize
3.89 KB

Oops, forgot to attach patch :)

martysteer’s picture

Status: Needs work » Needs review

The 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.

Status: Needs review » Needs work

The last submitted patch, views_376932_27.patch, failed testing.

brettbirschbach’s picture

Status: Needs review » Needs work
FileSize
10.37 KB

I 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.

Pol’s picture

Cool, that's really interesting !

It was something I was planning to do those days :-)

brettbirschbach’s picture

Pol, 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.

Pol’s picture

Ok I'll do it, it's gonna be ready for tomorrow probably.

Pol’s picture

The 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!

Pol’s picture

FileSize
70.61 KB

Added some new functions, screenshot updated.

byue’s picture

Return blank screen when views with this module enabled is in panels.

byue’s picture

Return blank screen when views with this module enabled is in panels.

Pol’s picture

I'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.

brettbirschbach’s picture

Pol,

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

brettbirschbach’s picture

In 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.

brettbirschbach’s picture

FileSize
2.5 KB

Attaching 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.

brettbirschbach’s picture

FileSize
930 bytes

Came 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.

Pol’s picture

Hello @HitmanInWis,

I've committed your patches, thanks !

Find the latest version here: https://github.com/Polzme/views_extra_operator

brettbirschbach’s picture

Pol,

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.

Pol’s picture

True, I'll sort this out tonight from home :-)

Thanks for reporting this.

Pol’s picture

Voila: 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.

kndr’s picture

Great 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?

Pol’s picture

Hello Kndr,

I've committed your patch, thanks :-) Let me know if everything works now.

kndr’s picture

Everything is OK. Thank you.

dawehner’s picture

I'm wondering whether you can create a project on drupal.org and use the issue queue there?

Then everyone would profit from it.

Pol’s picture

Hi 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.

pvasili’s picture

Pol, big thanks for your module. I think it should be added to the core views!

tnfno’s picture

Category: feature » support
Status: Needs work » Active

This 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 ?

andypost’s picture

Version: 6.x-2.x-dev » 8.x-3.x-dev

Suppose it makes a lot of sense, views could be used for autocomplete tasks in core

knigh7’s picture

Version: 8.x-3.x-dev » 7.x-3.x-dev
Assigned: Unassigned » knigh7
Category: support » feature

this should move to views core, thanks :)

andypost’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev

Current head is 8

pvasili’s picture

2 Pol, Your module now is not compatible with new Views 7-36 :(

Pol’s picture

Hi,

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.

dawehner’s picture

The patch in #48 seems to be very hardcoded, so I don't think this is core-worthy.

RgnYLDZ’s picture

Is 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"

andypost’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.x-dev
Component: Code » views.module
Assigned: knigh7 » Unassigned
Issue summary: View changes
Issue tags: +VDC

Maybe better to move this core, there's some sprints happens so bring this to radar

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Lendude’s picture

Status: Active » Closed (outdated)

As 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