You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm getting an odd error when I try to run the example from the elasticlunr documentation in node.js.
Running the following code in node:
varhttp=require('http');varelasticlunr=require("elasticlunr");varserver=http.createServer();varindex=elasticlunr(function(){this.addField('title');this.addField('body');this.setRef('id');});vardoc1={"id": 1,"title": "Oracle released its latest database Oracle 12g","body": "Yestaday Oracle has released its new database Oracle 12g, this would make more money for this company and lead to a nice profit report of annual year."}vardoc2={"id": 2,"title": "Oracle released its profit report of 2015","body": "As expected, Oracle released its profit report of 2015, during the good sales of database and hardware, Oracle's profit of 2015 reached 12.5 Billion."}index.addDoc(doc1);index.addDoc(doc2);index.search("Oracle database profit",{fields: {title: {boost: 2},body: {boost: 1}}});server.listen(process.env.PORT||3000,process.env.IP||"0.0.0.0",function(){varaddr=server.address();console.log("Chat server listening at",addr.address+":"+addr.port);});
I get the following error message:
/home/ubuntu/workspace/node_modules/elasticlunr/elasticlunr.js:731
var df = this.index[field].getDocFreq(term);
^
TypeError: Cannot call method 'getDocFreq' of undefined
at elasticlunr.Index.idf (/home/ubuntu/workspace/node_modules/elasticlunr/elasticlunr.js:731:30)
at elasticlunr.Index.computeSquaredWeight (/home/ubuntu/workspace/node_modules/elasticlunr/elasticlunr.js:898:22)
at Array.forEach (native)
at elasticlunr.Index.computeSquaredWeight (/home/ubuntu/workspace/node_modules/elasticlunr/elasticlunr.js:894:15)
at elasticlunr.Index.search (/home/ubuntu/workspace/node_modules/elasticlunr/elasticlunr.js:779:28)
at Object.<anonymous> (/home/ubuntu/workspace/server.js:29:7)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
Hi, I'm getting an odd error when I try to run the example from the elasticlunr documentation in node.js.
Running the following code in node:
I get the following error message:
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: