JohnAppleSeed- / searchEngine

A "search engine" written with node.js, angular, redis, mongoose, and socket.io
0 stars 0 forks source link

TypeError: Cannot read property 'length' of undefined #1

Open vimal-hoh opened 8 years ago

vimal-hoh commented 8 years ago

/home/vimal2/programs/search_engine_exaple/searchEngine/server.js:64 if (areas.length === 0) { ^

TypeError: Cannot read property 'length' of undefined at /home/vimal2/programs/search_engine_exaple/searchEngine/server.js:64:20 at Object.callbackOrEmit as callback_or_emit at RedisClient.return_error (/home/vimal2/programs/search_engine_exaple/searchEngine/node_modules/redis/index.js:701:11) at JavascriptReplyParser.Parser.returnError (/home/vimal2/programs/search_engine_exaple/searchEngine/node_modules/redis/index.js:193:18) at JavascriptReplyParser.run (/home/vimal2/programs/search_engine_exaple/searchEngine/node_modules/redis-parser/lib/javascript.js:135:18) at JavascriptReplyParser.execute (/home/vimal2/programs/search_engine_exaple/searchEngine/node_modules/redis-parser/lib/javascript.js:112:10) at Socket. (/home/vimal2/programs/search_engine_exaple/searchEngine/node_modules/redis/index.js:269:27) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at readableAddChunk (_stream_readable.js:146:16) at Socket.Readable.push (_stream_readable.js:110:10) at TCP.onread (net.js:529:20)

JohnAppleSeed- commented 8 years ago

If "areas" is coming back undefined it probably means that the data wasn't added to the database.

Before running the server you need to run:

node addtodb.js

And wait about two or three minutes for all the information to get added. Sorry there is no output to tell you when the process is done.

vimal-hoh commented 8 years ago

whenever I tried to Run addtodb.js in gives me this msgs.

node_redis: Deprecated: The SADD command contains a argument of type ObjectID. This is converted to "573eb7e97ab2208a0bba5f8c" by using .toString() now and will return an error from v.3.0 on. Please handle this in your code to make sure everything works as you intended it to.

JohnAppleSeed- commented 8 years ago

Okay, I just updated the addtodb.js script. It should work without error and also give more useful output.

JohnAppleSeed- commented 8 years ago

Also if you run the script multiple times you might need to delete the information already added to mongodb and redis or you will have a lot of duplicates.