Search code examples
djangofull-text-searchdjango-haystackdjango-sphinxdjango-search-lucene

Full Text Search for django using MySQL


I am from PHP and now using Django, I like match against queries of PHP and want to use some already developed app. for full text search. Good part is there are many available like djapian, sphinx, lucene,solango and haystack. And bad is I don't know what should I use? The app. is newer and search can be of different type like people search content search e.t.c. So I want it to be fast enough and quicker to implement and reliable.So do any one know that which one is better and can be later easily replaceable by our own if required?

Please also tell if writing own using Q is better option.

thanks


Solution

    • Use Haystack w/ Xapian, Solr backend or Djapian if your project is serious and search function will be used frequently.
    • Use homemade Q if you want to play w/ ORM or there are extra complex filter or other sorts of operations that Haystack does not support. Do not expect much from it.

    edit

    Haystack:

    • replacable backends, both Xapian and Solr are promising(stable, fast and low-cost on disk).
    • good integration w/ Django
    • tunable indexing policy
    • occasionally there might be something weird, you need to check code directly
    • installation of backends may be difficult on some platforms, but there are howto on the web

    Using MySQL builtin full text search, you need to:

    • maunally prepare DB, check the doc and Django MySQL full text search
    • write things like search-query parser and highlighter
    • aware the load of DB from searching
    • only work in MySQL, not easy in PostgreSQL yet
    • It is support by Django directly on ORM level, so complex filter can be done then. On Haystack, you need to choose the indexing terms and stored documents carefully for trading off between performance and functionality

    I've no experience w/ Sphinx, so did not mention it.