我在django-haystack
后端使用solr
。我没有得到任何结果。你能看一下吗?我已生成索引./manage.py build_solr_schema > k.xml
,然后在/example/solr/conf/schema.xml
文件中复制k.xml的内容。我错过了什么吗?感谢
search_indexes.py
class SongIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
def get_model(self):
return Song
歌曲模型
class Song(models.Model):
title = models.CharField(max_length=100)
artist = models.ManyToManyField(Artist)
def __unicode__(self):
return self.title
urls.py
sqs = SearchQuerySet()
url(r'^search/members/$', SearchView(
template='search/search.html',
searchqueryset=sqs,
), name='haystack_search'),
solr结果
INFO: [] webapp=/solr path=/select/ params={fl=*+score&start=0&q=(Hello)&wt=json&fq=django_ct:(song.song)&rows=0} hits=0 status=0 QTime=1