Remove extra stop words

This wasn't really working correctly - the stop word 'work' would leave
instances of 'working' and 'works' in the index for example.
This commit is contained in:
James Nylen 2020-05-04 09:32:43 +00:00
parent e983d65e01
commit 68b94f3b84

View file

@ -566,22 +566,6 @@ exports.buildSearchData = data => {
// https://github.com/olivernn/lunr.js/issues/25#issuecomment-623267494
this.metadataWhitelist = ['position'];
// How to find more stop word candidates:
// cat site/build/assets/search-1588572080743.js | jq -r '.textData | .[] | .[]'
// paste the output into this tool:
// https://www.online-utility.org/text/analyzer.jsp
const extraStopWords = lunr.generateStopWordFilter( [
'career',
'company',
'employees',
'job',
'remote',
'team',
'work',
] );
lunr.Pipeline.registerFunction( extraStopWords, 'extraStopWords' );
this.pipeline.after( lunr.stopWordFilter, extraStopWords );
Object.keys( textData ).forEach( c => this.add( textData[ c ] ) );
} );