0

I have a search-based website. It contains several search criterions which can be a little complex or convoluted. I have migrated all original client's data into Drupal nodes and taxonomies. Now my doubt is if I can rely on Views 3 + Filters + Contextual filters alone, or should I construct direct calls to the database via db_query, or, the most versatile and still Drupal-oriented idea, use the Views 3 with contextual filters, but altering the sql code with views_query_alter (for example, for converting "=" to "LIKE" for a filter). What would you recommend?

4
  • Whatever is easiest for you to write. But you shouldn't need views_query_alter just to use LIKE operator, as far as I remember.
    – Mołot
    Oct 1, 2015 at 9:25
  • Thanks Molot. I didn't find any option to use LIKE, so I googled it and found the source code for the views_query_alter modification. In any case, I will use it for more complex things than just "LIKE". I'll try to read more about "LIKE" parameters in contextual filters. Thanks!
    – Cesar
    Oct 1, 2015 at 9:41
  • See drupal.stackexchange.com/a/88638/16495
    – Mołot
    Oct 1, 2015 at 9:54
  • Molot, I have tried for a while and cannot find the Operators Contains, equal, etc... or even AND, OR, etc... in the contextual filters. They apply, however, to normal or exposed filters. My experience is that Contextual Filters behave in a different manner, this is why it is necessary to modify them programmaticaly. But I might be wrong, there are so many options that I could be missing something. I need them to be contextual filters.
    – Cesar
    Oct 1, 2015 at 14:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.