I'd like to have possibilty to use more then one type of operation at once.
For example, I'd like to say taxonomy/term/1,2+3,4 (nodes with terms 1 and 2 or with terms 3 and 4), or
taxonomy/term/1,2+1,4 (that'd be the same as 1,(2+4) - it means terms with 1 and (2 or 4))

Comments

Cvbge’s picture

StatusFileSize
new4.56 KB

Since it's not easy to add mixed operators i've started with something simpler - adding !term (not term) support. This allows to use something like taxonomy/term/1,!3

The patch is just a test, it'll be completly rewritten to support mixed operators (if I implement it), but at least shows that adding ! operator is quite simple and can be done without big changes.

Cvbge’s picture

Here's another dirty patch - this time everything is implemented, but I need to clean it up and make a patch against 4.6.0/cvs - currently it's against little modified 4.6.0 version (but, OTOH, taxonomy_select_nodes gets allmost completly rewritten so it does not matter too much).

This patch allows combining AND (,), OR (+) and NOT (!) operators for taxonomy selections, e.g.
taxonomy/term/1,2+3+4,!5,!6/3

Cvbge’s picture

StatusFileSize
new10.47 KB

Attached patch works, is cleaned, and is against DRUPAL-4-6 :)
Comments are welcome.

BTW, implicit object creating (taxonomy.module line 936: $current->tid = $tids[0];, $current was NULL before that) is generating errors in PHP5, as chx says. Probably needs to be fixed.

Cvbge’s picture

Warnings, not "errors"

moshe weitzman’s picture

'patch' status is reserved for patch files against HEAD that are ready for core commit team to review. If you have a known bug, don't use this status. The queue should be as clean as possible.

Cvbge’s picture

ACK, didn't know about it. It's not explained anywhere (at least I couldn't find it).

The patch wasn't for the bug, but for the feature I requested. Anyway, I'll try to make a patch against HEAD (I did it for 4.6 as I had 4.6 installed and running and I needed this feature :))

Cvbge’s picture

Version: 4.6.0 »
StatusFileSize
new10.98 KB

New version, against cvs this time.

I don't know how to handle NOT operator. Should "!termX" mean "nodes that have different then termX terms" or "nodes that do not have termX"? For example, let's say user specifies "!1", and we have two nodes with terms:
nodeA: 1,2
nodeB: 2
Should we display nodeA (it has term not being term "1" - "2") [and node B], or node B only (it does not have term "1"). Second option seems better (currently first option is implemented). Maybe add new operator for first option? I'll have to rewrite it.

There were following difference between 4-6 and head:

-    // Build title:
-    $result = db_query('SELECT name FROM {term_data} WHERE tid IN (%s)', implode(',', $tids));
+    $result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (%s)', 't', 'tid'), implode(',', $tids));
+    $tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.

Currently this is not implemented in my patch (according to drupaldocs it's not working for taxonomy anyway) because I'm not sure if simply removing terms is good.

ricabrantes’s picture

Version: » 7.x-dev
Status: Active » Closed (fixed)

bump

ricabrantes’s picture

Status: Closed (fixed) » Active
catch’s picture

Status: Active » Closed (won't fix)

This is better handled by views.