Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
8.4.4
-
None
-
Unknown
-
Description
The default value of filterQuery in Main.SolrSearchConfig is currently an empty array. When this array stay empty, the solr search macros will add some default filters in order to filter hidden documents and to limit the search to the current wiki (or if main to the wiki configured to be searched with main). However, as soon as this filter is not empty, these default filters are no more added.
This is very different from the way the SolrSearchSuggest works. In there, we already have some value for qf, and since the default filter is also needed, these are added even if the "array" is not empty. The check is done so that if the hidden filter is not explicitly set, the default one is used (based on user prefs), and same for the wiki filter.
Why having taken two opposite approaches ?
IMO, the way the suggest works is smarter and more in line with expectations. Replicating the code that adds the default filters in all customization of the search is not optimum in my opinion. Moreover, there is a lot of chances that doing so will be forgotten.
So I would like us to consider implementing the injection of the default filters in the solr search macro using the same logic that is used for suggest. Check if the filter exists (for wiki and hidden), and add the default one if none has been explicitly specified.