You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/12/21 23:11:14 UTC

[GitHub] aaronmarkham closed pull request #12689: [WIP] Search update

aaronmarkham closed pull request #12689: [WIP] Search update 
URL: https://github.com/apache/incubator-mxnet/pull/12689
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/_static/js/docversion.js b/docs/_static/js/docversion.js
index f87c4587b4a..88da6dd64b6 100644
--- a/docs/_static/js/docversion.js
+++ b/docs/_static/js/docversion.js
@@ -1,5 +1,5 @@
 function setVersion(){
-        let doc = window.location.pathname.match(/^\/(api\/.*)$/) || window.location.pathname.match(/^\/versions\/[^*]+\/(api\/.*)$/);
+        let doc = window.location.pathname.match(/^\/versions\/[0-9.master]+\/([^*]+.*)$/);
         if (doc) {
             if (document.getElementById('dropdown-menu-position-anchor-version')) {
                     versionNav = $('#dropdown-menu-position-anchor-version a.main-nav-link');
@@ -7,11 +7,11 @@ function setVersion(){
                             currLink = $( el ).attr('href');
                             version = currLink.match(/\/versions\/([0-9.master]+)\//);
                             if (version) {
-                                    versionedDoc = '/versions/' + version[1] + '/' + doc[1] + (window.location.hash || '');
+                                    versionedDoc = '/versions/' + version[1] + '/' + doc[1] + (window.location.hash || '') + (window.location.search || '');
                                     $( el ).attr('href', versionedDoc);
                             }
                     });
-            }        
+            }
         }
 }
 
diff --git a/docs/_static/searchtools_custom.js b/docs/_static/searchtools_custom.js
index 5f8c30a24f1..6a1b10b3858 100644
--- a/docs/_static/searchtools_custom.js
+++ b/docs/_static/searchtools_custom.js
@@ -570,7 +570,7 @@ var Search = {
         }
         Search.title.text(_('Search Results'));
         if (!resultCount)
-          Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
+          Search.status.text(_('Your search did not match any documents in this version of the documentation. You can use the dropdown selector in the navigation bar to try another version. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
         else
             Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
         Search.status.fadeIn(500);
diff --git a/docs/build_version_doc/artifacts/.htaccess b/docs/build_version_doc/artifacts/.htaccess
index d553ce5a8dc..661bd7c5f5d 100644
--- a/docs/build_version_doc/artifacts/.htaccess
+++ b/docs/build_version_doc/artifacts/.htaccess
@@ -1,28 +1,32 @@
 RewriteEngine on
-RewriteRule ^get_started/why_mxnet.html$ /faq/why_mxnet.html [R=301,L]
-RewriteRule ^get_started.*$ /install/ [R=301,L]
-RewriteRule ^how_to.*$ /faq/ [R=301,L]
-RewriteRule ^api/python/symbol.html$ /api/python/symbol/symbol.html [R=301,L]
-RewriteRule ^community/index.html$ /community/contribute.html [R=301,L]
+RewriteRule .* - [E=default_version:/versions/master]
+RewriteRule ^get_started/why_mxnet.html$ %{ENV:default_version}/faq/why_mxnet.html [R=301,L]
+RewriteRule ^get_started.*$ %{ENV:default_version}/install/ [R=301,L]
+#RewriteRule ^get_started.*$ versions/master/install [R=301,L]
+RewriteRule ^how_to.*$ %{ENV:default_version}/faq/ [R=301,L]
+RewriteRule ^api/python/symbol.html$ %{ENV:default_version}/api/python/symbol/symbol.html [R=301,L]
+RewriteRule ^community/index.html$ %{ENV:default_version}/community/contribute.html [R=301,L]
 
 # Navigation bar redirects to latest info
-RewriteRule ^versions/[^\/]+/architecture/.*$ /architecture/ [R=301,L]
-RewriteRule ^versions/[^\/]+/community/.*$ /community/ [R=301,L]
-RewriteRule ^versions/[^\/]+/faq/.*$ /faq/ [R=301,L]
-RewriteRule ^versions/[^\/]+/gluon/.*$ /gluon/ [R=301,L]
-RewriteRule ^versions/[^\/]+/install/.*$ /install/ [R=301,L]
-RewriteRule ^versions/[^\/]+/tutorials/(.*)$ /tutorials/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/architecture/(.*)$ %{ENV:default_version}/architecture/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/community/(.*)$ %{ENV:default_version}/community/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/faq/(.*)$ %{ENV:default_version}/faq/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/gluon/(.*)$ %{ENV:default_version}/gluon/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/install/(.*)$ %{ENV:default_version}/install/$1 [R=301,L]
+RewriteRule ^versions\/[0-9.]+\/tutorials/(.*)$ %{ENV:default_version}/tutorials/$1 [R=301,L]
 
 # Redirect navbar APIs that did not exist
-RewriteRule ^versions/0.11.0/api/python/contrib/onnx.html /error/api.html [R=301,L]
-RewriteRule ^versions/0.12.1/api/python/contrib/onnx.html /error/api.html [R=301,L]
-RewriteRule ^versions/1.0.0/api/python/contrib/onnx.html /error/api.html [R=301,L]
-RewriteRule ^versions/1.1.0/api/python/contrib/onnx.html /error/api.html [R=301,L]
+RewriteRule ^versions/0.11.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/0.12.1/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/1.0.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/1.1.0/api/python/contrib/onnx.html %{ENV:default_version}/error/api.html [R=301,L]
 
-RewriteRule ^versions/0.11.0/api/clojure/.*$ /error/api.html [R=301,L]
-RewriteRule ^versions/0.12.1/api/clojure/.*$ /error/api.html [R=301,L]
-RewriteRule ^versions/1.0.0/api/clojure/.*$ /error/api.html [R=301,L]
-RewriteRule ^versions/1.1.0/api/clojure/.*$ /error/api.html [R=301,L]
-RewriteRule ^versions/1.2.1/api/clojure/.*$ /error/api.html [R=301,L]
+RewriteRule ^versions/0.11.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/0.12.1/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/1.0.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/1.1.0/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L]
+RewriteRule ^versions/1.2.1/api/clojure/.*$ %{ENV:default_version}/error/api.html [R=301,L]
 
+# Redirect any root requests to the default version
+RewriteRule ^(?!versions\/[0-9.master]+\/)(.*)$ %{ENV:default_version}/$1 [R=301,NC,L]
 ErrorDocument 404 https://mxnet.incubator.apache.org/error/404.html


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services