Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this work with newer sphinx? #2

Open
mattip opened this issue Oct 11, 2022 · 4 comments
Open

Does this work with newer sphinx? #2

mattip opened this issue Oct 11, 2022 · 4 comments

Comments

@mattip
Copy link
Owner

mattip commented Oct 11, 2022

There is some hint that Sphinx==3.5.4 does not work properly

@OATalha
Copy link
Contributor

OATalha commented Oct 11, 2022

Which is the recommended version of sphinx to try?

@mattip
Copy link
Owner Author

mattip commented Oct 11, 2022

Tests run with these versions:

sphinx-version: [2.4.4, 3.0.4, 3.2.1]

@OATalha
Copy link
Contributor

OATalha commented Oct 12, 2022

results are similar for me from 2.4.4 to 5.2.3

@OATalha
Copy link
Contributor

OATalha commented Oct 13, 2022

okay there is a little difference if the affiliate index is generated from 5.2.3

It does appear to work properly for 5.2.3 if we apply the following changes to searchtools.js


--- a/docs/source/sphinx_affiliates/searchtools.js
+++ b/docs/source/sphinx_affiliates/searchtools.js
@@ -339,7 +338,9 @@ var Search = {
     var results = [];

     for (var prefix in objects) {
-      for (var name in objects[prefix]) {
+      for (var obj_index in objects[prefix]) {
+        var obj_data = objects[prefix][obj_index];
+        var name = obj_data[4];
         var fullname = (prefix ? prefix + '.' : '') + name;
         var fullnameLower = fullname.toLowerCase()
         if (fullnameLower.indexOf(object) > -1) {
@@ -353,7 +354,7 @@ var Search = {
           } else if (parts[parts.length - 1].indexOf(object) > -1) {
             score += Scorer.objPartialMatch;
           }
-          var match = objects[prefix][name];
+          var match = objects[prefix][obj_index];
           var objname = objnames[match[1]][2];
           var title = titles[match[0]];
           // If more than one term searched for, we require other words to be

But then it won't work for older versions (for now, I can't say which ones)

Also there should be an adequate way of ensuring that all affilates have already been set before search is executed just like it is deferred until setIndex.

check this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants