Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Contextual filters do not get added to the query.
apachesolr_views_query->build() does not include the filters created by apachesolr_views_handler_argument.
Code such as
if (isset($this->params['filters'])) {
$params['fq'] = $this->params['filters'];
}
adds them but that will interfere with
if (!empty($conditions_string)) {
$params['fq'] = $conditions_string;
}
Comment | File | Size | Author |
---|---|---|---|
#18 | use_arguments-1750952-18.patch | 1.66 KB | MiroslavBanov |
#13 | use_arguments-1750952-13.patch | 1.06 KB | itamar |
#8 | use_arguments-1750952-8.patch | 1.12 KB | roynilanjan |
#1 | use_arguments-1750952-1.patch | 598 bytes | theapi |
Comments
Comment #1
theapi CreditAttribution: theapi commentedI've attached a patch to use the arguments set by apachesolr_views_handler_argument.
It want have an effect if $conditions_string is set.
Comment #2
sylus CreditAttribution: sylus commentedPatch works great thanks @PeterC, Contextual arguments with Apache Solr + Views FTW!
Comment #3
f16viper CreditAttribution: f16viper commentedPatch works fine - it made my day to finally have conditional filters working again - thanks heaps
Comment #4
mindbat CreditAttribution: mindbat commentedPatch didn't work for me on version 7.x-1.0-beta1.
Contextual filters seem to be ignored altogether in the Apache Solr-based view.
Comment #5
heacu CreditAttribution: heacu commentedhi,
i just tried this patch with version 7.x-1.0-beta2, and it worked for me.
ed
Comment #6
rjbrown99 CreditAttribution: rjbrown99 commentedPatch here, changing status.
Comment #7
roynilanjan CreditAttribution: roynilanjan commentedPatch works fine ... is there any possibility to use Equivalent of "OR"(of a sql)
basically filter array consists all the arguments it behaves like "AND"(of a sql)
Please let me know
Comment #8
roynilanjan CreditAttribution: roynilanjan commentedthere is still need some work with this patch although it works only for contextual filter but with Filter criteria & contextual filter together will not work (although it's default function of view) .. this patch can solve the issue.
Please have a test & let me know
Comment #9
babruix CreditAttribution: babruix commentedYes, last patch works as well, checked against 7.x-1.0-beta2.
Thanks!
Comment #10
DrDam CreditAttribution: DrDam commentedYes, last patch works as well, checked against 7.x-1.0-beta2.
Thanks!
Comment #11
Marc Angles CreditAttribution: Marc Angles commented#8 appply and works on 7.x-1.0-beta2
Comment #12
acidpotato CreditAttribution: acidpotato commented#8 works for me as well. Can this be added to 7.x.1.x-Dev?
Comment #13
itamar CreditAttribution: itamar commentedThe patch from #8 might cause a notice when
params['filters']
is not set. Here's a re-roll with a slight cleanup.Comment #14
TechNikh CreditAttribution: TechNikh commented#13 applies and works well.
Comment #15
TechNikh CreditAttribution: TechNikh commentedIf there are more than one view in a single page, use https://drupal.org/node/1766254#comment-7721963
Comment #16
MiroslavBanov CreditAttribution: MiroslavBanov commentedConfirm that #13 works fine for me.
Comment #17
MiroslavBanov CreditAttribution: MiroslavBanov commentedOn second thought, I don't like how the contextual filters are using a separate add_filter function. They should be using add_where, same as regular filters. This is how database views work, too.
Comment #18
MiroslavBanov CreditAttribution: MiroslavBanov commentedHere's a new patch as per #17
Comment #20
MiroslavBanov CreditAttribution: MiroslavBanov commented