Commits

Jon Waltman committed fffa9be

Closes #1074: Add environment version info to the generated search index to avoid compatibility issues.

Comments (0)

Files changed (2)

 Release 1.2 (in development)
 ============================
 
+* #1074: Add environment version info to the generated search index to avoid
+  compatibility issues with old builds.
+
 * #1110: Added a new configuration value :confval:`texinfo_no_detailmenu` for
   controlling whether the Texinfo writer generates a ``@detailmenu`` in the
   "Top" node's menu.

sphinx/search/__init__.py

             format = self.formats[format]
         frozen = format.load(stream)
         # if an old index is present, we treat it as not existing.
-        if not isinstance(frozen, dict):
+        if not isinstance(frozen, dict) or \
+           frozen.get('envversion') != self.env.version:
             raise ValueError('old format')
         index2fn = frozen['filenames']
         self._titles = dict(zip(index2fn, frozen['titles']))
         objnames = self._objnames
         return dict(filenames=filenames, titles=titles, terms=terms,
                     objects=objects, objtypes=objtypes, objnames=objnames,
-                    titleterms=title_terms)
+                    titleterms=title_terms, envversion=self.env.version)
 
     def prune(self, filenames):
         """Remove data for all filenames not in the list."""