I'm new to whole search stuff and having a hard time learning haystack.(solr as backend)
Here is my understanding of haystack/solr.
Please comment on it if my understanding is wrong.
Solr
solr is document search engine. (opposed to RDBMS)
It allows user to quickly search document for a given term.(inverted-index may be used for this)
solr also allows facet-search given that documents are well structured.(as in xml)
Haystack
For some applications(such as eCommerse site), it would be a good idea to store product data in a RDBMS.(Well xml could also work, but I just guess that RDBMS is better at updating than xml)
If we store product data in RDBMS, we could write queries to fetch relavant data for user query, but it's troublesome.
Haystack can convert data in RDBMS to document so that solr can index it.
After solr indexes data, most of search can be delegated to solr.
Here comes the question.
Can I create DB schema as I want and still use the haystack/solr?
suppose I have DB model as follows, What would my search_indexes.py look like to enable faceted search for any category?
...
class Category(models.Model):
name = models.CharField(max_length=200)
parentCategory = models.ForeignKey('self', null=True, blank=True)
class Item(models.Model):
name = models.CharField(max_length=200)
categorys = models.ManyToManyField(Category)
details = models.CharField(max_length=1024)
Note, Category can be nested(category can have a parent category).
<p></p>
to separate the list and the code; or indent the code twice (8 spaces) – okm