Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
Views integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2011 at 17:22 UTC
Updated:
13 Sep 2019 at 07:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drunken monkeyMore a feature request, maybe I'll do it together with #1119594: Fix Views argument handlers. Contextual filters are currently lagging a bit behind, as filters are used more often.
And no, I don't think there is another way. Or maybe you could use an exposed filter, and pass the correct filter values directly in the URL? Then you'd just have to hide the exposed form element.
But, of course, just allowing multiple values is a lot cleaner and probably even easier.
Comment #2
floleft commentedI tried views php as a filter as well and it didn't return a result. I'm still trying other ways.
Comment #3
floleft commentedAny word on if this is a feature we can expect in the near future? Just curious; as I'll need to find a way around this if it's not a priority.
Comment #4
drunken monkeyWhile I see this is an important feature request, I sadly won't have the time to work on this in the near future. You are free to come up with a patch yourself, though, I'd surely review and (when acceptable, of course) commit it.
Comment #5
floleft commentedThank you for your response.
Comment #6
amitaibuSorry, subscribe.
Comment #7
amitaibuThe problem with exposing the filter for e.g. node ID, is that if I try to pass multiple values (1,2,...) I get
Comment #8
moonray commentedNeed this as well... same problem as #7.
Comment #9
moonray commentedAttached is a patch that makes numeric arguments allow multiple values. It probably needs some work to make it consistent across search_api, but this fulfills my needs. Posting to give whomever will write the patch a headstart.
Comment #10
moonray commentedOK, definitely needs work.
If you pass too many parameters to the argument (see below), it'll break. A better way to do it would be to use the 'IN' operator, but that's not currently supported by search_api's query interface.
Passing this parameter (which results in more than 100 filter conditions) breaks the query interface:
EDIT: this was while using apache solr. Perhaps it works for non solr searches.
Comment #11
moonray commentedJust confirmed, this is a search_api_solr issue. My patch does work. :)
Solr issue: #1276970: Large queries break solr search
Comment #12
drunken monkeyThanks a lot for the patch! I'm sorry I took so long to respond, but I'm currently completely buried in work. Will review the patch once I get the time, but sounds very promising!
Comment #13
drunken monkeyFinally managed to look into this – sorry it took me so long!
I wonder a bit, why did you only use this for numeric arguments, and not just for all? I don't really see a reason for that (except, of course, for fulltext and MLT arguments). I therefore moved the functionality to the main argument handler.
Other than that: Bravo! An excellent patch, even with my usual nit-picky way I hardly had to change anything.
Please someone test and/or review, then I think we can commit this!
Comment #14
dasjonice, applying the patch enabled me to use multiple terms ("id1+id2") as contextual filter with search api.
Comment #15
drunken monkeySeems to work fine, and since no-one complained in the last eight months, I'm committing it.
Comment #16
nbucknor commentedI've added a patch to this patch to allow an exclude option on contextual filters. Related to #1407844: Allow exclude for contextual filters
Comment #17
drunken monkeyPlease post that in the other issue, where it belongs.
And remove the spaces from empty lines.
Comment #18
nbucknor commentedMy apologies. Patch posted here: http://drupal.org/node/1407844#comment-5994260
Comment #20
l0calh0rst commentedTiny question concerning this: this post is ~1.5 years old but it seems this patch is not part of the current stable release (7.x-1.8) which is from sept 1st 2013. It only works in the latest dev.
Any particular reason?
Comment #21
gouthamraon commentedYou can pass multiple values using contextual filter,
Select Raw Value from Url and select PathComponent/arugument.
Below we have More section from that you can check Allow multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).
http://example.com/some-path/24+25
or
http://example.com/some-path/24,25