Alex Roe
Alex Roe

Reputation: 586

Using Solr for indexing and search with Mongodb and nodejs

Does anyone have any experience with this particular stack? I'm working on a web project that will eventually contain an extremely large amount of data and was trying to get Solr to play nicely with some simple Mongodb entries but I have found little to no information about it. I found this: http://blog.knuthaugen.no/2010/04/cooking-with-mongodb-and-solr.html which is mongodb + solr + php, but I'm struggling to see how I would use node similarly. Anybody have any insight? I'd greatly appreciate it. If this is a dumb thing to try to implement, feel free to let me know as well!

Found this library: https://github.com/tjgillies/node-lucene

Doesn't look like there is much documentation there but I'll give it a go.

Update: So a quick fix (not ideal) that worked was to use a Perl module for lucene and then using the child process functionality in Node.js, I was able to insert and search for my data inside of lucene. So for a workaround, it does the trick.

Upvotes: 11

Views: 9741

Answers (2)

Hitesh Joshi
Hitesh Joshi

Reputation: 724

Probably as of Sep 2012, you would want to take a look at this.

https://github.com/lbdremy/solr-node-client

Good documentations http://lbdremy.github.com/solr-node-client/ (though I didnt liked the web fonts used) but seems VERY promising.

Upvotes: 4

wprl
wprl

Reputation: 25437

This project looks promising: https://github.com/gsf/node-solr. Not a whole lot of docs, but the tests are promisingly descriptive.

Then you would maybe do something like this in your mongoose schema:

schema.pre('save', function (next) {
  // this will be triggered when your mongoose schema object is saved
  // TODO add to a queue that sends the documents to SOLR in e.g. batches
  //      of 2000
});

http://mongoosejs.com/docs/middleware.html

I've been wanting to try mongo + SOLR + node but haven't started any coding yet.

Upvotes: 3

Related Questions