Nasty has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/345848 )
Change subject: ExtendedSearch: Autocomplete was ignoring namespaces configuration ...................................................................... ExtendedSearch: Autocomplete was ignoring namespaces configuration The autocomplete field will now use the namespace filter. Fixed issue: ERM4018 Needs merge to master Change-Id: I299699d213b65ff85839222fbd26f866f09e6d0a --- M ExtendedSearch/includes/SearchIndex/SearchOptions.class.php 1 file changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions refs/changes/48/345848/1 diff --git a/ExtendedSearch/includes/SearchIndex/SearchOptions.class.php b/ExtendedSearch/includes/SearchIndex/SearchOptions.class.php index 4f7d836..25e4cae 100644 --- a/ExtendedSearch/includes/SearchIndex/SearchOptions.class.php +++ b/ExtendedSearch/includes/SearchIndex/SearchOptions.class.php @@ -184,7 +184,7 @@ public function getSolrAutocompleteQuery( $sSearchString, $sSolrSearchString ) { $aSearchOptions = array(); $aSearchOptions['fl'] = 'type,title,namespace'; - $aSearchOptions['fq'] = array( 'wiki:(' . $this->getCustomerId() . ')' ); + $aSearchOptions['fq'] = $this->makeAutoCompleteFilterQuery(); $aSearchOptions['sort'] = $this->aSearchOptions['sort']; $vNamespace = $this->checkSearchstringForNamespace( @@ -617,4 +617,20 @@ //'assembleSearchOptions' if 'MW::ExtendedSearch::ShowFacets' is true $this->aFacetFields[] = $sFacetField; } + + protected function makeAutoCompleteFilterQuery() { + $oUser = RequestContext::getMain()->getUser(); + $aOptions = $oUser->getOptions(); + $aNamespaces = [ 1000 ]; //For some strange reason 1000 is NS_SPECIAL within the SOLR index + foreach ( $aOptions as $sOpt => $sValue ) { + if ( strpos( $sOpt, 'searchNs' ) !== false && $sValue == true ) { + $aNamespaces[] = '' . str_replace( 'searchNs', '', $sOpt ); + } + } + + return array( + 'wiki:(' . $this->getCustomerId() . ')', + 'namespace:("'.implode( '" OR "', $aNamespaces ).'")' + ); + } } -- To view, visit https://gerrit.wikimedia.org/r/345848 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I299699d213b65ff85839222fbd26f866f09e6d0a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: REL1_27 Gerrit-Owner: Nasty <kon...@hallowelt.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits