diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-10-05 15:55:39 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-10-05 15:55:39 +0200 |
commit | 7f0e4803e266e11ef3aedc041c63b99cd2cce7e2 (patch) | |
tree | 22d70a8389336ecd4231f7e84efdf265a2eb7230 /lib/book.js | |
parent | fa76029a1789d23f80d8eaac2fc7b872440fd75e (diff) | |
download | gitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.zip gitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.tar.gz gitbook-7f0e4803e266e11ef3aedc041c63b99cd2cce7e2.tar.bz2 |
Start removing search and lunr from core
Diffstat (limited to 'lib/book.js')
-rw-r--r-- | lib/book.js | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/book.js b/lib/book.js index c755c27..72f0ec2 100644 --- a/lib/book.js +++ b/lib/book.js @@ -1,7 +1,6 @@ var Q = require('q'); var _ = require('lodash'); var path = require('path'); -var lunr = require('lunr'); var parsers = require('gitbook-parsers'); var fs = require('./utils/fs'); @@ -78,16 +77,6 @@ var Book = function(root, context, parent) { this.readmeFile = null; this.langsFile = null; - // Search Index - this.searchIndexEnabled = true; - this.searchIndexSize = 0; - this.searchIndex = lunr(function () { - this.ref('url'); - - this.field('title', { boost: 10 }); - this.field('body'); - }); - // Bind methods _.bindAll(this); }; @@ -595,7 +584,6 @@ Book.prototype.parsePage = function(filename, options) { }) .then(function() { - that.indexPage(page); return page; }); }; @@ -755,31 +743,6 @@ Book.prototype.contentLink = function(link) { return links.normalize(this.contentPath(link)); }; -// Index a page into the search index -Book.prototype.indexPage = function(page) { - var nav = this.navigation[page.path]; - if (!nav || !this.searchIndexEnabled) return; - - this.log.debug.ln('index page', page.path); - - // Extract text from the page - var text = pageUtil.extractText(page.sections); - - // Limit size of index (to avoid #941) - this.searchIndexSize = this.searchIndexSize + text.length; - 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; - } - - this.searchIndex.add({ - url: this.contentLink(page.path), - title: nav.title, - body: text - }); -}; - // Default structure paths to an extension Book.prototype._defaultsStructure = function(filename) { var that = this; |