Comments (1)
Using stop words from multiple languages may not be a good idea. Here's a few reasons:
- what is a stopword in a language may not be a stopword in another, so valuable results may be lost because of excluding
- besides stopwords, you may also need to consider stemming for both languages. Again, this may create very confusing results because it is basically impredictable how this can be done? First stemming the first language and then the second, or the other way around?
I would say there is no nice & easy solution for this.
However, you can add the german stopwords to the english ones at the runtime. You will have to require
both english and german files, however you will not have to use
the german one at all. To do this, use the following code:
global.lunr = require('./lib/lunr.js');
require('./lunr.stemmer.support.js');
require('./lunr.de.js');
require('./lunr.fr.js');
// add german stopwords to the english ones
for(var i = 0; i < lunr.de.stopWordFilter.stopWords.length; i++ ) {
lunr.stopWordFilter.stopWords.add(lunr.de.stopWordFilter.stopWords.elements[i]);
}
// you can do the same for any other languages, but use lunr.<languagecode>.stopWordFilter
var idx = lunr(function () {
// don't use any language extension, as the default english lunr is already populated with the stopwords
this.field('title', { boost: 10 })
this.field('body')
});
from lunr-languages.
Related Issues (20)
- Error when initializing `lunr.th.js` HOT 1
- Is this repository dead? HOT 1
- Add language support for Catalan
- How should I use it in ES6?
- lunr.zh.js can`t search 'database' HOT 4
- React JS
- Accented letter ê should be replaced by e in the french stemmer HOT 1
- Usage of Lunr js with Turkish language
- Minified version of the Thai language is missing HOT 2
- lunr-languages/lunr.fr.js fails to find common words like "équipement" HOT 3
- Can "nodejieba" be as "devDependency" or "peerDependency" in lunr-languages? HOT 4
- Update nodejs version in CI
- nodejieba (Chinese) is not working with webpack HOT 1
- lunr.de fails with umlaute in wildcard search
- Arabic HOT 1
- Search indexing for Chinese language (lunr.zh) does not work with multi-language HOT 4
- Idea: Use Intl.Segmenter to reduce bundle size in browsers
- Error when using lunr.zh.js 'nodejieba.cut is not a function' HOT 2
- Cannot read properties of undefined (reading 'registerFunction') HOT 1
- Add language support for Sanskrit, Kannada & Telugu HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lunr-languages.