From 510d4b30fdfe417a0b0cf74846cfb041a26db200 Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Fri, 8 Jul 2016 17:05:26 -0400 Subject: [PATCH] Add maxResults to Search component --- src/components/search.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/search.js b/src/components/search.js index bf12818..9c45819 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -54,6 +54,8 @@ export default class Search extends React.Component { results = this.index.search(this.tokenize(value)).map((result) => result.ref ) + + results = results.slice(0, this.props.maxResults) } this.props.onSearch(results) @@ -76,8 +78,10 @@ export default class Search extends React.Component { Search.propTypes = { onSearch: React.PropTypes.func, + maxResults: React.PropTypes.number, } Search.defaultProps = { onSearch: (() => {}), + maxResults: 75, }