Hi,

if you add and exposed filter of a taxonomy term (i suppose that whatever integer value is affected), and you dont give a value an invalid solr query is constructed and solr gives an error.

here is a log of the query: im_field_obra_clasificaciongener:()) is wrong.

INFO: [] webapp=/solr path=/select params={f.im_field_obra_clasificaciongener.facet.limit=50&f.bm_field_obra_adquisicion_recien.facet.mincount=1&facet=true&f.itm_field_obra_datacion_1.facet.mincount=1&facet.mincount=1&f.im_field_obra_clasificaciongener.facet.mincount=0&qf=taxonomy_names^2.0&qf=label^5.0&qf=content^40&qf=tos_content_extra^0.1&qf=tos_name^3.0&f.itm_field_obra_datacion_1.facet.limit=50&q.alt=(bundle:(obra)+AND+im_field_obra_clasificaciongener:())&json.nl=map&f.itm_field_obra_anio_ingreso.facet.mincount=1&wt=json&rows=10&fl=id,entity_id,ts_snippet&f.itm_field_obra_anio_ingreso.facet.limit=50&facet.sort=count&start=0&q=&f.bm_field_obra_adquisicion_recien.facet.limit=50&facet.field=itm_field_obra_anio_ingreso&facet.field={!ex%3Dim_field_obra_clasificaciongener}im_field_obra_clasificaciongener&facet.field=bm_field_obra_adquisicion_recien&facet.field={!ex%3Ditm_field_obra_datacion_1}itm_field_obra_datacion_1} status=400 QTime=3

It seens that the apachesolr_views_handler_filter class is not asking for the right value to check if it is empty.

In the following code snippet $this->value is an Array (at least when a taxonomy is used), so we must check for empty($this->value[0])

class apachesolr_views_handler_filter extends views_handler_filter {
  function query() {
    if (!empty($this->value)) {
      if (is_array($this->value)) {
        $this->value = implode(' OR ', $this->value);
      }
      $this->query->add_where($this->options['group'], "$this->real_field", $this->value, $this->operator);
    }
  }

I send a patch in a moments.

Best
David

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david.gil’s picture

here is my patch,
not sure if it is ok in all situations.

Best! and nice job ygerasimov (if i can help you here i am).

David

ygerasimov’s picture

Status: Active » Fixed

Yes, good idea to check the whether argument is empty or not. But it is better to trim all array elements and then filter them out. I have fixed this issue with commit be69a31

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.