I am creating a web application using Django, and I'll have to add search functionality soon. Search is going to be implemented for 2 models, one becoming an extension from the auth user class and the other one using the fields
description. And So I guess nothing too frightening within context of searching text.
For development I'm using SQLite so that as no database specific work continues to be done, I'm at liberty to make use of any database being produced. I am considering selecting between PostgreSQL or MySQL.
I have undergone several posts on the internet about search solutions, nonetheless Let me get opinions for my simple situation. Listed here are my questions:
is full-text search an overkill during my situation?
is it more beneficial to depend around the database's full-text search support? If that's the case, which database must i use?
tags is really a Tagfield (in the django-marking application) that sits on the m2m relationship.
description is really a area that holds HTML and it has a max_period of 1024 bytes.
In the event that area
tags means what It means, i.e. you intend to keep a string which concatenates multiple tags to have an item, then you will need full-text explore it... but it is a poor design rather, you ought to have a many-many relationship between products along with a tags table (in another table, ItemTag or something like that, with 2 foreign secrets which are the main secrets from the products table and tags table).
I can not tell whether you'll need full-text explore
description when i don't have any indication of what it's -- nor whether you'll need the reasonable but somewhat rudimentary full-text search that MySQL 5.1 and PostgreSQL 8.3 provide, or even the more effective one out of e.g. sphinx... maybe talk a little much more about the context of the application and why you are thinking about full-text search?
Edit: therefore it appears the only real possible requirement for full-text search may be on
description, which appears like it's most likely limited enough that either MySQL 5.1 or PostgreSQL 8.3 assists rid of it. Me, I've got a sweet place for PostgreSQL (despite the fact that I am reasonably expert at MySQL too), but that is an over-all preference, not particularly attached to full-text search issues. This blog provides one good reason to prefer PostgreSQL: you could have full-text search but still be transactional, during MySQL full-text indexing only focus on MyISAM tables, not InnoDB [[until you add sphinx, obviously]] (also see this follow-on for a little more about full-text search in PostgreSQL and Lucene). Still, you will find obviously other factors involved with selecting a DB, and that i don't believe you will be doing terribly with either (unless of course needing to add sphinx for full-text plus transaction is really a large problem).
Django has full text searching support in the QuerySet filters. At this time, should you have only two models that require searching, simply make a view that searches the fields on:
search_string = "+Django -jazz Python" first_models = FirstModel.objects.filter(headline__search=search_string) second_models = SecondModel.objects.filter(headline__search=search_string)
You can further filter these to make certain the outcomes are unique, if required.
Furthermore, there's a regex filter that might be better still for coping with your html fields and tags because the regex can show the filter on just how to process any delimiters or markup.
Whether you'll need an exterior library is dependent in your needs. Just how much traffic shall we be speaking about? The exterior libraries are usually better if this involves performance, but of course you will find pros and cons. I'm using Sphinx with django-sphinx wordpress plugin, and I would suggest it if you are doing lots of searching.