The list of stop words in Elasticsearch is:
a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with
The list of JavaScript reserved keywords is:
abstract, arguments, await, boolean, break, byte, case, catch, char, class, const, continue, debugger, default, delete, do, double, else, enum, eval, export, extends, false, final, finally, float, for, function, goto, if, implements, import, in, instanceof, int, interface, let, long, native, new, null, package, private, protected, public, return, short, static, super, switch, synchronized, this, throw, throws, transient, true, try, typeof, var, void, volatile, while, with, yield
That means that the overlap is:
for, if, in, this, with
And the remainder of the English stop words is:
a, an, and, are, as, at, be, but, by, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, to, was, will
Why does this matter? It matters when you're writing a search engine on English text that is about JavaScript. Such as, MDN Web Docs. At the time of writing, you can search for this
because there's a special case explicitly for that word. But you can't search for for
which is unfortunate.
But there's more! I think we should consider certain prototype words to be considered "reserved" because they are important JavaScript words that should not be treated as stop words. For example...
of
- fromfor (const thing of things)
orArray.of(...)
String.prototype.at
Object.is()
Comments
not reserved words but:
- "as" is commonly used in typescript.
- "then": Promise.then()
- And now we have "at" in arrays: [1,2,3].at(1)
Thanks!
I don't work on that search engine any more but I hope the people who took over is considering this.