Currently the query generated by the numeric handler only generates a correct SQL statement for 'or' operators when working with mulitple-term arguments (e.g. /myview/2+3+4) but does not work with the 'and' operator (/myview/2,3,4). This patch adds a HAVING clause to the 'and' queries that requires that all of the terms matched in the 'IN' where clause are matched.

I admit not being very familiar with views, but after several days poring over the code, I think I produced a proper fix and not just a bandaid. This patch works for me in a view I created using multiple term IDs as the arguments.

CommentFileSizeAuthor
views-multi-term-argument.patch1.49 KBvhmauery

Comments

dawehner’s picture

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

This seems to be required for 6.x-3,x too

dawehner’s picture

Status: Needs review » Needs work

+        $this->query->add_having_expression(0, "COUNT({$this->table_alias}.{$this->real_field}) = :nrvals", array(':nrvals' => count($this->value)));

This syntax{} doesn't look how the rest of views. Additional nrvals is a bad variable name. It should be more readable.

mustanggb’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)