Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ language: node_js
node_js: node
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "sh -e /etc/init.d/xvfb start"
addons:
firefox: "51.0"
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# bit-docs-html-canjs

[![Build Status](https://travis-ci.org/canjs/bit-docs-html-canjs.svg?branch=master)](https://travis-ci.org/canjs/bit-docs-html-canjs)
[![npm version](https://badge.fury.io/js/bit-docs-html-canjs.svg)](https://www.npmjs.com/package/bit-docs-html-canjs)

## Initial install:

```
Expand Down
14 changes: 8 additions & 6 deletions static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,22 @@ var Search = Control.extend({
if (searchTerm.indexOf('can-') > -1) {// If the search term includes “can-”

// look for an exact match and apply a large positive boost
q.term(searchTerm, { usePipeline: true, boost: 375 });
q.term(searchTerm, { boost: 375 });

} else {
// add “can-”, look for an exact match in the title field, and apply a positive boost
q.term('can-' + searchTerm, { usePipeline: false, boost: 12 });
q.term('can-' + searchTerm, { boost: 12 });

// look for terms that match the beginning or end of this query
q.term(searchTerm, { usePipeline: false, wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
// look in the title field specifically to boost matches in it
q.term(searchTerm, { fields: ['title'], wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
q.term(searchTerm, { wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
}

// look for matches in any of the fields and apply a medium positive boost
var split = searchTerm.split(lunr.tokenizer.separator);
split.forEach(function(term) {
q.term(term, { usePipeline: false, fields: q.allFields, boost: 10 });
q.term(term, { boost: 10, fields: q.allFields });
});
});

Expand Down Expand Up @@ -717,14 +719,14 @@ var Search = Control.extend({

resetScrollToTop: function(activeResultPosTop){
this.$resultsContainer.scrollTop(
this.$resultsContainer.scrollTop() +
this.$resultsContainer.scrollTop() +
activeResultPosTop
);
},

resetScrollToBottom: function(activeResultPosTop, resultsContainerHeight){
// Calculate active result's position bottom
var scrollTo = (activeResultPosTop + this.$activeResult.outerHeight()) -
var scrollTo = (activeResultPosTop + this.$activeResult.outerHeight()) -
// Calculate the current scrolled position of the bottom of the list
(this.getActiveResultOffset() + resultsContainerHeight);

Expand Down