In addition to the basic argument handling, it would be great to have the ability to pass in multiple values as in normal views arguments. Also, in order to be consistent with views, the handler should support the ability to exclude these items.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joel_osc’s picture

Title: Contextual filter support for multiple items » Contextual filter support for multiple values
Status: Active » Needs review
FileSize
2.03 KB

Here is a patch for review and testing.

joel_osc’s picture

Fixed an error due to the default operator not being set.

joel_osc’s picture

Oops... masked a bug in last patch - this should actually fix it.

elstudio’s picture

Works for me!

Patch #3 is extremely helpful -- thanks!

hefox’s picture

Looks like this patch covers #1425464: Apache Solr View Argument Handlers Missing D7 also

edit: nevermind, didn't look at the issue status of the other issue, other then that my make file was using it

hefox’s picture

hefox’s picture

Messed up the real patch

hefox’s picture

Hm, not didn't work, so switched it over to using what the field handler does for not.

MiroslavBanov’s picture

Looking at the last patch, I don't think that 'not' and 'break_phrase' would work well together. The "-" would be applied to the first one only. Also, if consistency with Views is the goal, this should probably be a apachesolr_views_handler_argument_numeric handler that inherits apachesolr_views_handler_argument.

hefox’s picture

Sorry, haven't looked into the internals of how add_where works, but

      $this->value = implode(' ' . strtoupper($this->operator) . ' ', $this->value);

So, value is now VAL1 AND VAL 2 AND VAL 3;

    $prefix = empty($this->options['not']) ? '' : '-';

    $this->query->add_where(0, $prefix . "$this->real_field", $this->value);

It's adding the '-' to field name looks like, so

-field_name = VAL1 AND VAL 2 AND VAL 3

I don't think this would apply to just one value since it's negative is on field name and not value.

Other then rolling it so patch applies to -dev, the only difference I recall adding was handing the negative, no opinion on _numeric or not.

MiroslavBanov’s picture

Yes, you're right. I got confused about the "-". It applies to the entire field.