Fix #952: add configuration for index maximum size

This commit is contained in:
Samy Pessé
2015-09-28 20:54:45 +02:00
parent db9151ae36
commit c931e91bef
2 changed files with 6 additions and 3 deletions
+1 -3
View File
@@ -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;
+5
View File
@@ -201,6 +201,11 @@ Configuration.DEFAULT = {
// version of gitbook to use
"gitbook": "*",
// Search index
"search": {
"maxIndexSize": 1000000
},
// Structure
"structure": {
"langs": "LANGS.md",