Currently there is Argument 'Apache Solr: Taxonomy terms' which returns all nodes tagged by specified terms.
I wonder if there something opposite. Argument, which list all nodes which are not tagged by specified terms.

Comments

kenorb’s picture

Currently I've tried to inject it in PHP Code like:

return apachesolr_views_query::escape_term(-1);
return db_query("SELECT td.name, td.tid FROM {term_data} td WHERE td.tid IN (" . implode(', ', array_fill(0, sizeof($argument), '%d')) . ")", $argument);

but no luck and I'm not sure how this can be solved in easy way.
Related: #187922: Negative arguments
Any ideas?

kenorb’s picture

In Views in: ./handlers/views_handler_argument_numeric.inc - options_form()
we have following code:

    $form['not'] = array(
      '#type' => 'checkbox',
      '#title' => t('Exclude the argument'),
      '#description' => t('If selected, the numbers entered in the argument will be excluded rather than limiting the view.'),
      '#default_value' => !empty($this->options['not']),
    );

In Apache Solr Views handlers/apachesolr_views_handler_argument.inc is not there.
It's something that can be implemented?

kenorb’s picture

Title: Negate of Taxonomy terms argument » Exclude the argument - Negate of Taxonomy term arguments
Scott Reynolds’s picture

So the steps to add this
1.) Add the exclude option to the apachesolr_views_argument_handler::option_definition()
2.) Add the form element for the exclude option in apachesolr_views_argument_handler::option_form()
3.) change apachesolr_views_argument_handler::query() 's call to add_filter by this

$this->query->add_filter($this->real_field, apachesolr_views_query::escape_term($facet_value), $this->options['exclude']);
kenorb’s picture

Status: Active » Needs review
StatusFileSize
new981 bytes

Lol, it looks like it's working.
Big thanks!!!

Scott Reynolds’s picture

Status: Needs review » Fixed
StatusFileSize
new1.61 KB

http://drupal.org/cvs?commit=405316

You should use

cvs diff -up

u and p flags gives a unified patch, that is much easier to read, see attached.

http://drupal.org/patch/create

Status: Fixed » Closed (fixed)

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