summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-09-28 20:54:45 +0200
committerSamy Pessé <samypesse@gmail.com>2015-09-28 20:54:45 +0200
commitc931e91befe143a8ed13d74e1b7d7b9fa6bb11d2 (patch)
treeca8417f3de7b59f8e000bbd8b988b9c656b725d0
parentdb9151ae365cf774d6178fe538f1fcb4423bdeb9 (diff)
downloadgitbook-c931e91befe143a8ed13d74e1b7d7b9fa6bb11d2.zip
gitbook-c931e91befe143a8ed13d74e1b7d7b9fa6bb11d2.tar.gz
gitbook-c931e91befe143a8ed13d74e1b7d7b9fa6bb11d2.tar.bz2
Fix #952: add configuration for index maximum size
-rw-r--r--lib/book.js4
-rw-r--r--lib/configuration.js5
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/book.js b/lib/book.js
index 84d3c6b..514a719 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -19,8 +19,6 @@ var PluginsList = require("./pluginslist");
var generators = require("./generators");
-var SEARCHINDEX_MAXSIZE = 1000000;
-
var Book = function(root, context, parent) {
this.context = _.defaults(context || {}, {
// Extend book configuration
@@ -751,7 +749,7 @@ Book.prototype.indexPage = function(page) {
// Limit size of index (to avoid #941)
this.searchIndexSize = this.searchIndexSize + text.length;
- if (this.searchIndexSize > SEARCHINDEX_MAXSIZE) {
+ if (this.searchIndexSize > this.config.get('search.maxIndexSize')) {
this.log.warn.ln("search index is too big, indexing is now disabled");
this.searchIndexEnabled = false;
return;
diff --git a/lib/configuration.js b/lib/configuration.js
index b314492..c8b15b8 100644
--- a/lib/configuration.js
+++ b/lib/configuration.js
@@ -201,6 +201,11 @@ Configuration.DEFAULT = {
// version of gitbook to use
"gitbook": "*",
+ // Search index
+ "search": {
+ "maxIndexSize": 1000000
+ },
+
// Structure
"structure": {
"langs": "LANGS.md",