Closed (fixed)
Project:
Search API
Version:
7.x-1.0-rc1
Component:
Views integration
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Dec 2011 at 04:35 UTC
Updated:
7 Jan 2012 at 22:30 UTC
Just hoping you could point me in the right direction. What I want to do, is provide a list of nid's to exclude from a search api solr based view.
With a standard view, i was doing this by implementing hook_views_query_alter and adding a condition of NOT IN for the array of nids to exclude. Any way I can achieve the same result using SOLR index?
Thanks in advance.
Comments
Comment #1
drunken monkeyThere are
hook_search_api_query_alter()andhook_search_api_solr_query_alter()– and evenhook_views_query_alter()might work (can't really say due to lack of docs).With the former two,
$query->getOption('search id')helps identify the search.PS: Oh, there just is no "NOT IN" operator, you'll have to use multiple "<>" conditions.
Comment #2
modstore commentedThanks for the fast and helpful reply as always.
I implemented the hook as follows:
This works great, if I have less than 90 nids to exclude, but over that and I get the following error:
'413' Status: Request Entity Too Large
I guess if there is no way to have more than this, I will have to create a new indexed field and base my filter on that.
Comment #3
romenov commentedComment #4
drunken monkey@ romenov: Please don't give tips if you don't understand the problem at hand.
@ modstore: This is actually a Solr-specific restriction, see #1276970: Large queries break solr search. Basically, this would be fine with the Search API no matter how many values you want to exclude.
Comment #5
modstore commentedI see, thanks for the update, I will follow the other issue and go from there. Thanks mate.
Comment #6
modstore commentedMade the update as per link in #4 and it fixed it for me. Thanks Drunken Monkey.