server/devdocs/index.js
function queryDocs( query ) {
	return docsIndex.search( query ).map( result => {
		const doc = documents[ result.ref ],
			snippet = makeSnippet( doc, query );

		return {
			path: doc.path,
			title: doc.title,
			snippet: snippet,
		};
	} );
}
function queryDocs( query ) {
	return docsIndex.search( query ).map( result => {
		const doc = documents[ result.ref ],
			snippet = makeSnippet( doc, query );

		return {
			path: doc.path,
			title: doc.title,
			snippet: snippet,
		};
	} );
}
function queryDocs ( query ) { return docsIndex . search ( query ) . map ( result => { const doc = documents [ result . ref ] , snippet = makeSnippet ( doc , query ) ; return { path : doc . path , title : doc . title , snippet : snippet , } ; } ) ; }
Query the index using lunr.
We store the documents and index in memory for speed,
and also because lunr.js is designed to be memory resident
@param {object} query The search query for lunr
@returns {array} The results from the query
Query the index using lunr . We store the documents and index in memory for speed and also because lunr . js is designed to be memory resident