cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
446 stars 67 forks source link

Search the pages/blog in all versions #19

Closed micael-atos closed 3 years ago

micael-atos commented 3 years ago

Currently it's possible to search in the pages/blog only with the latest version. It's not obvious for a user to go to the latest version to find information in the pages/blog.

One way that this could be achieved is using the lunr.Query.presence.PROHIBITED field from lunr:

                versionExcluded = (...);
                if (versionToSearch) {
                  query.term(versionExcluded, {
                    fields: ["version"],
                    boost: 0,
                    presence: lunr.Query.presence.PROHIBITED,
                  });

And not link the pages and the blog to the latest version while creating the index, keep it as undefined:

          if (useDocVersioning) {
            indexDoc.version = docVersion;  // ? docVersion : docVersions[0];
          }
cmfcmf commented 3 years ago

Thank you for your detailed explanation and blueprint for the solution! This indeed was quite the confusing behavior and has been fixed in version 0.5.0. :tada: