I've changed views_filters_selective_handler_filter to

/**
 * Callback implementation for generic filter.
 */ 
function views_filters_selective_handler_filter($filter, $field, $oids) {
  $options = array();

  // TODO: Handle relationships.
  $result = db_query("SELECT DISTINCT({$filter->field}) FROM {{$filter->table}} WHERE {$filter->view->base_field} IN (%s)", implode(',', $oids));
  while ($id = db_fetch_array($result)) {
    $options[] = $id[$filter->field];
  }

  return $options;
}

to work for me. [views 6.x-2.11]

CommentFileSizeAuthor
#3 views_filters_selective.module.patch750 bytescyclonas

Comments

infojunkie’s picture

Status: Active » Needs work

Please submit a patch with the change (to allow me to see what changed) and also explain the logic behind it. What filters did you test this with?

infojunkie’s picture

And also, what kind of error did you encounter that prompted this change?

cyclonas’s picture

StatusFileSize
new750 bytes

MySQL 5.1.50

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') FROM WHERE nid IN (603,604,605,606,607,608,609,610,611,612,613,614,615,616,61' at line 1 query: views_filters_selective_handler_filter /* user : views_filters_selective_handler_filter */ SELECT DISTINCT() FROM WHERE nid IN (603,604,605,....long list) in D:\www\www.example.com\htdocs\sites\all\modules\views_hacks\views_filters_selective\views_filters_selective.module on line 145.

cyclonas’s picture

For taxonomy term filter with depth i get this

user warning: Unknown column 'term_node_tid_depth' in 'field list' query: views_filters_selective_handler_filter /* user : views_filters_selective_handler_filter */ SELECT DISTINCT(term_node_tid_depth) FROM node WHERE nid IN (1284,1285,1286,1287,1288,1289,1290,......) in D:\www\www.example.com\htdocs\sites\all\modules\views_hacks\views_filters_selective\views_filters_selective.module on line 145.

Limit list to selected items:true
Limit list to result set: true
Further limit list to active filters : default

infojunkie’s picture

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

You already reported the problem about the filter "Taxonomy:Term ID (with depth)" in this issue: #856736: Selective Exposed Filters does not work with hierarchy and I've submitted a fix to this problem.

Furthermore, your patch here is not correct because this filter does not declare a field that can be read from the database. Thus, the views_filters_selective_handler_filter logic will never work for it. The fix I submitted in the other issue takes this fact into consideration.