Closed (fixed)
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
More Like This
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 May 2012 at 10:54 UTC
Updated:
21 Mar 2018 at 22:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dzieyzone commentedFix-custom-filter-on-mlt-blocks-settings.patch queued for re-testing.
Comment #4
travismark commentedRevised patch.
Comment #5
travismark commented--- a/sites/all/modules/apachesolr/apachesolr_search.module
+++ b/sites/all/modules/apachesolr/apachesolr_search.module
@@ -604,7 +604,11 @@
if ($custom_filters = $settings['mlt_custom_filters']) {
// @todo - fix the settings form to take a comma-delimited set of filters.
- $query->addFilter('', $custom_filters);
+ $custom_filters = explode(',',$custom_filters);
+ foreach ($custom_filters as $custom_filter){
+ list($filter_index, $filter_value) = explode(":",$custom_filter);
+ $query->addFilter($filter_index, $filter_value);
+ }
}
Comment #6
travismark commentedComment #7
nick_vhComment #8
nick_vhPlease use two spaces instead of a tab.
We might also want to validate the filter before we send it to addFilter. See validFilterValue in solr_base_query.php
Comment #9
nick_vhThis is not a bug, it's a feature request. It works perfectly without this. Hoping to get some more response from people in this issue
Comment #10
travismark commentedHi Nick, Yeah I agree.. just in case some devs need this feature they might stumble in this ticket tand have idea how to make it work. Thanks for you help! :)
Comment #11
travismark commentedComment #12
nick_vhWell, you don't need to close it just yet ;-)
Comment #13
jrreid commentedThis works for me. In fact without it the custom filters don't seem to work for me on the latest 7.x-1.x when I was creating/testing #2017135: Add token for local site hash value. The @todo a few lines up can probably also be removed as this handles that.
Comment #14
pwolanin commentedComment #15
wulff commentedI've been trying to add a date filter to one of our MLT blocks, to make sure that the block only contains fairly recent content:
ds_created:[2008-01-01T00:00:01Z TO *]With the current version of the module, this results in the following parameter being added to the query string (url decoded):
fq=:"ds_created:[2014-01-01T12:00:00Z TO *]"This does not seem to work as intended.
After applying a cleaned-up version of the patch in #6, the following parameter is added to the query string (url decoded):
fq=ds_created:[2014-01-01T12:00:00Z TO *]This seems to work as intended.
I have attached an updated patch.
Comment #16
darvanenUsing the recently updated 7.x-1.7 module, custom filters weren't working **at all**. This patch (#15) fixed it for me.
Comment #17
den tweed commentedHad same problem with custom filter not working, patch #15 fixed this.
Comment #18
darvanenChanging status to RTBC as #15 now has 3 confirmed uses with no constructive feedback after 9 months. Has been in production for at least 2 months here with no bugs found.
Comment #19
nick_vhSeems reasonable for me. Will add it to the next release :)
Comment #20
maxocub commented+1
Comment #21
nareshbw commentedUsed patch # 15 it is working fine for me .
Comment #22
edjeavons commentedPatch #15 has solved the problem for me as well. Thank you.
Comment #24
janusman commentedFixed