Hi,

is there a simple other way for disabling search indexing for the HTML
builder?

I have found none, so prepared a little patch to optionally disable
the search index creation (for example when using a theme without search
box and external indexers like Lucence/SOLR later).

It speeds up creation of a larger docset by approximately 30%.
(104 seconds before, 69 seconds without search index).

Trivial patch against a Sphinx 1.13 is in the attachment
(not yet adding documentation/quickstart for this, just the new config
flag still kept to default = 'True')

Maybe its useful to someone.

Michael

-- 
Michael Schlenker
Software Architect

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: [email protected]

Sitz der Gesellschaft: Bremen
Geschäftsführer: Karl Heinz Zachries, Ralf Holtgrefe
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Index: config.py
===================================================================
--- config.py   (revision 88631)
+++ config.py   (working copy)
@@ -110,6 +110,7 @@
         html_secnumber_suffix = ('. ', 'html'),
         html_search_language = (None, 'html'),
         html_search_options = ({}, 'html'),
+        html_search_enabled = (True, 'html'),
 
         # HTML help only options
         htmlhelp_basename = (lambda self: make_filename(self.project), None),
Index: builders/html.py
===================================================================
--- builders/html.py    (revision 88631)
+++ builders/html.py    (working copy)
@@ -239,10 +239,14 @@
         lang = self.config.html_search_language or self.config.language
         if not lang or lang not in languages:
             lang = 'en'
-        self.indexer = IndexBuilder(self.env, lang,
-                                    self.config.html_search_options)
-        self.load_indexer(docnames)
 
+        if self.config.html_search_enabled:
+            self.indexer = IndexBuilder(self.env, lang,
+                                        self.config.html_search_options)
+            self.load_indexer(docnames)
+        else:
+            self.indexer = None
+
         self.docwriter = HTMLWriter(self)
         self.docsettings = OptionParser(
             defaults=self.env.settings,
@@ -550,7 +554,8 @@
 
         # add context items for search function used in searchtools.js_t
         ctx = self.globalcontext.copy()
-        ctx.update(self.indexer.context_for_searchtool())
+        if self.config.html_search_enabled:
+            ctx.update(self.indexer.context_for_searchtool())
 
         # then, copy over theme-supplied static files
         if self.theme:
@@ -752,7 +757,8 @@
             copyfile(self.env.doc2path(pagename), source_name)
 
     def handle_finish(self):
-        self.dump_search_index()
+        if self.config.html_search_enabled:
+            self.dump_search_index()
         self.dump_inventory()
 
     def dump_inventory(self):

Reply via email to