I created a view where I have a taxonomy term including CAPS (i.e. Ada Specifications and Declarations), however, in the path, the term is transformed (by autopath) in lowercase and dashes between each word (i.e. ada-specifications-and-declarations).
When I compare the term, I get this SQL, even though the "Ignore case" flag is turned ON:
SELECT node.changed AS node_changed,
node.title AS node_title,
node.nid AS nid,
term_data.name AS term_data_name,
term_data.vid AS term_data_vid,
term_data.tid AS term_data_tid
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
INNER JOIN term_data term_data ON term_node.tid = term_data.tid
WHERE (node.status = 1) AND (node.type in ('geshinode')) AND (term_data.name = 'Ada Specifications and Declarations')
ORDER BY node_title ASC
It seems to me that the last WHERE clause should include LOWER() calls as in:
(LOWER(term_data.name) = LOWER('Ada Specifications and Declarations'))
and it would work whatever the case, right?
I even happen to have the patch for the problem, although I think we'll be missing the same LOWER() in 2 other cases (I fixed 2 already...)
Thank you.
Alexis Wilke
Comments
Comment #1
AlexisWilke commentedThere is a better patch that also implements the 'in' operator.
Comment #2
dawehnerIf a option is defined in the views_handler_argument_string the specific change is only required in this handler.
This is the advantage of OOP class inheritance
Comment #3
AlexisWilke commenteddereine,
That's where I first looked. However, the helper functions are being used from any other object...
I agree that my changes may look ugly, although you do use $this->handler->stuff for many things in the helper class, so I thought it would be okay. The helper class is not derived one way or the other from the string field implementation and it does not, as it is, support the lowercase feature. (You can test for yourself!)
Now, there are 2 other solutions I guess...
1) Re-implement the helper functionality in the strings since the helper is too basic to support all the necessary features necessary to make the string object work as necessary; or
2) Add an "ignore_case" field in the helper class (which is certainly what I would have done in C++ which would not allow for $this->handler->blah tests unless that 'blah' field was also defined in the base class.)
I think (2) is better. Of course, since other argument implementations could also benefit from having the "ignore_case" field, maybe adding it to the base class would be an even better idea. The clean way of doing things is to make all fields private and write functions to get their current value:
$this->handler->get_ignore_case()would be the best way to know whether the case should be ignored.
Just in case, the patch in #2 was the same as in #1. I meant to upload this one instead.
Thank you.
Alexis Wilke
Comment #4
AlexisWilke commentedHi Dereine,
May I have some clarifications so we can move this forward?
As I mentioned, the test is wrong in the helper function. It somehow needs to be fixed. Let me know how you think it should be done.
Thank you.
Alexis
Comment #5
mustanggb commented