0
class Org(models.Model):
    org_name = models.CharField(max_length=255)
    name = models.CharField(max_length=50)
    phone = models.CharField(max_length=50)
    email_id = models.EmailField()
    incorporation_date = models.DateTimeField()

    def __unicode__(self):
        return self.org_name

Data at hand org_name, name, phone, email_id, incorporation_date... How can I use the data I have to compare with the data in model and display results based on relevance.

Example:

Apple, Steve, 000-000-0000, steveo@apple.com, 1979

I should be able to compare Apple with data in org_name, Steve in name etc.., and display the rows which has the match and in descending order of relevance using DJANGO!

Santosh S Kumar
  • 469
  • 1
  • 6
  • 30

1 Answers1

0

You could cook something up using the SQL, but the proper solution for this is using a full-text search engine. Haystack is a great package that will let you solve this quickly.

atereshkin
  • 696
  • 5
  • 8
  • Haystack with Solr is an option but the above query will be used by only one user and hardly once in a month, I am assuming haystack and solr for this requirement is little too much of work. – Santosh S Kumar Dec 24 '12 at 06:46
  • 1
    @SantoshSKumar no need to use Solr - you can use Haystack with Whoosh which doesn't require any separate setup and should be easy to get started with. – atereshkin Dec 24 '12 at 08:06