PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/sphinxtest/tests/models.py

Relevant Search: With Applications for Solr and Elasticsearch

For more in depth reading about search, ranking and generally everything you could ever want to know about how lucene, elasticsearch or solr work under the hood I highly suggest this book. Easily one of the most interesting technical books I have read in a long time. If you are tasked with solving search relevance problems even if not in Solr or Elasticsearch it should be your first reference. Amazon Affiliate Link
http://django-sphinx.googlecode.com/
Python | 19 lines | 13 code | 6 blank | 0 comment | 0 complexity | 1b56712fcb15e4de7ab90a5822029815 MD5 | raw file
 1from django.db import models
 2
 3from djangosphinx import SphinxSearch
 4
 5import datetime
 6
 7class Group(models.Model):
 8    name = models.CharField(max_length=32)
 9
10class Document(models.Model):
11    group       = models.ForeignKey(Group)
12    date_added  = models.DateTimeField(default=datetime.datetime.now)
13    title       = models.CharField(max_length=32)
14    content     = models.TextField()
15    
16    search      = SphinxSearch(index="test")
17    
18    class Meta:
19        db_table = 'documents'