Extension talk:MixedNamespaceSearchSuggestions

Jump to navigation Jump to search

About this board

Does not work on pages with multiple search inputs

1
Rudloff (talkcontribs)

It would be nice to allow it on the "mw-searchInput" class as well:

diff --git a/resources/ext.mnss.search.js b/resources/ext.mnss.search.js
index 0a3e666..88e9149 100644
--- a/resources/ext.mnss.search.js
+++ b/resources/ext.mnss.search.js
@@ -51,7 +51,7 @@
        }

        $( document ).ready( function () {
-               var $searchInput = $( '#searchInput' );
+               var $searchInput = $( '#searchInput, .mw-searchInput' );
 
                $searchInput.suggestions( {
                        fetch: function ( query ) {
Reply to "Does not work on pages with multiple search inputs"
Miken32 (talkcontribs)

It seems to be down to the TitleKey extension, which purposely strips off the namespaces. Hacking that extension fixed things for us.

Also we had to add a CSS rule to get the namespace lining up with the article title:

div.suggestions-result {
    white-space: inherit;
}
Jkmartindale (talkcontribs)

How'd you patch TitleKey? I'm interested as well.

Miken32 (talkcontribs)

Basically just comment out the stuff that purposely breaks namespaces:

diff --git a/TitleKey_body.php b/TitleKey_body.php
index 63cf769..b0b7b87 100644
--- a/TitleKey_body.php
+++ b/TitleKey_body.php
@@ -140,10 +140,10 @@ class TitleKey {
        }
        
        static function prefixSearch( $namespaces, $search, $limit, $offset ) {
-               $ns = array_shift( $namespaces ); // support only one namespace
-               if( in_array( NS_MAIN, $namespaces ) )
-                       $ns = NS_MAIN; // if searching on many always default to main 
-               
+#              $ns = array_shift( $namespaces ); // support only one namespace
+#              if( in_array( NS_MAIN, $namespaces ) )
+#                      $ns = NS_MAIN; // if searching on many always default to main 
+               $ns = $namespaces;
                $key = self::normalize( $search );
                
                $dbr = wfGetDB( DB_SLAVE );
Reply to "Did not work for us in 1.27"
Wess (talkcontribs)

We tried to make this extension work, but it seems that it is dependent on CirrusSearch and only worked after CS was installed.

Jkmartindale (talkcontribs)

I'm using it on my stock MediaWiki 1.27.1 installation. Not sure why it wasn't working for you.

Reply to "CirrusSearch dependency?"
Rosencrantz~mediawikiwiki (talkcontribs)

Thanks for making this extension! I was getting a bunch of requests from my users about being unable to find things they were looking for. This should help out immensely.

Also, it seems to be working fine on 1.23.1 (at least for me anyway).

This post was posted by Rosencrantz~mediawikiwiki, but signed as Rosencrantz.

Reply to "Thanks!"
There are no older topics