146 points · by albertzeyer · 13y ago · 44 comments
For example, you could use Whoosh for development environment and Elasticsearch for production if you need something more robust.
With Python this is usually very easy.
I've maintained my fair share of legacy code and more often than not one of the biggest issues is tracking down ancient libraries which work with my code. There are very few packages I trust to maintain fairly stable interfaces and be available years into the future (things like Apache HTTPd, PostgreSQL and memcached); everything else lives in the project lib folder. I can "hg clone" my app at any time and get the exact version of the third party packages I need.
Every so often I update the packages and test the integration.
Looking now, it seems that pip can finally do this with pip-compile.
Also, a pure-python solution allows for an in-process index/search, rather than adding another external process dependency which needs to be monitored and maintained.
I think that would be a very difficult argument to make.
edit: I don't mean to say that it is a selling feature for everyone (i.e. people who aren't already using Python) but for those who are already using Python it definitely is.
You won't convince them, they've already jumped off the cliff. It's all perfectly normal to them. If you want to do development, find a company that hasn't been contaminated yet.
Whoosh is fine for very small datasets (megabytes) and low loads, just watch out for file permission issues.
http://elasticsearch.com/product/ ("petabytes of data with ease")
It's probably the best first iteration search app that I've come across, and you can always slip in solr or something with more umph when you need it.
The documentation indicates there is a multiprocessing option. (Also configurable memory limits, if you didn't see that.)
When document counts get into the hundreds you see orders of magnitude faster queries with SOLR (etc), not to mention much more sophisticated querying options.
I think this makes it pretty clear. Not sure how much more explanation you need.
FWIW I'm using Flask, Flask-SQLAlchemy, Whoosh and Flask-WhooshAlchemy [0]. Quick to get going with but the mix-and-match approach lets me easily rip pieces out as the project grows.
To put it in context, the psycopg2 calls to PostgreSQL take about 100ms to retrieve the associated data once I've found my search results with Whoosh.
(Most of my response time sits with SQLAlchemy ORM, building up matrices of data, which is why in production I'm caching the more complex queries with memcached).
Overall, for a project of this size (I can't imagine having to index more than a few hundred thousand objects) I'm very happy with Whoosh. If I get to the point of indexing millions of objects, I'll optimize it then.
It seems to be designed for indexing manpages. That is, a medium-sized semi-static database with a few different dimensions per document.