

Ask HN: What's the best way to handle full-text search with MongoDB? - bradleyjoyce


======
rlivsey
We're using ElasticSearch [1] and finding it really nice to work with.

It's basically Lucene with a nice JSON/RESTful interface and distributed out
of the box.

Unlike most other Lucene based systems that I've played with it allows you to
get started without having to define your schema upfront, so you can just
chuck data at it and worry about field types later.

It's under constant development and the community is really helpful.

[1] - <http://www.elasticsearch.com/>

~~~
bradleyjoyce
do you feel it's "production ready"?

~~~
rlivsey
We've not put it into production yet (it's coming in the new version) but are
putting it through its paces in staging and it's handling things well so are
confident it's ready for our usage.

There are people on the mailing list which are using it for some fairly hefty
things.

Usual case of YMMV and as with anything it's worth taking a bit of time to try
out the various options and see how they stack up for your usage. A good thing
about ES is that it's so quick and easy to get running that trying it out and
doing some benchmarking is pretty trivial.

------
asheeshlaroia
Use SOLR for indexing your full text. (By all means store your data in Mongo,
but when it comes time to search, search SOLR instead.)

------
bobf
Have you considered Riak+RiakSearch? I'm in a similar bind, and have been
looking into that.

------
pierrefar
I'm using sphinx. Works a treat.

~~~
bradleyjoyce
do you now of any good resources for getting started with sphinx + mongodb
(preferably on rails).. thanks!

~~~
pierrefar
It's really easy: Sphinx has a data import interface called xmlpipe2 which
takes an XML stream/file and feeds it to Sphinx for indexing. So I wrote a
small PHP command line script that gets all the documents I want indexed from
MongoDB and formats them as XML. I gave a talk about it last year:

[http://skillsmatter.com/podcast/cloud-grid/mongodb-full-
text...](http://skillsmatter.com/podcast/cloud-grid/mongodb-full-text-search-
with-sphinx)

The other aspect of coure is configuring Sphinx. That really depends on what
you're doing and want from it. The forums are helpful and the documentation
and wiki are superb. Really they are - read them!

