缺少结果django haystack与solr
我正在使用缺少结果django haystack与solr,django,solr,django-haystack,Django,Solr,Django Haystack,我正在使用django haystack和solr后端。我在模型中保存了三首歌曲。当我搜索q=“Hello world”时。它只显示一个结果。应该是三点。还复制了schema.xml并更新了索引rebuild\u index。我错过什么了吗?谢谢 你好,世界 你好 世界 这是我的搜索索引 class SongIndex(indexes.RealTimeSearchIndex, indexes.Indexable): text = indexes.CharField(document=Tr
django haystack
和solr
后端。我在模型中保存了三首歌曲。当我搜索q=“Hello world”
时。它只显示一个结果。应该是三点。还复制了schema.xml
并更新了索引rebuild\u index
。我错过什么了吗?谢谢
- 你好,世界
- 你好
- 世界
class SongIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
title = indexes.EdgeNgramField(model_attr='title')
def get_model(self):
return Song
搜索查询
sqs = SearchQuerySet().models(Song).filter(title=AutoQuery('Hello World'))
更新:已尝试
sqs = SearchQuerySet().models(Song).filter(title='Hello World')
尝试:
最后一件事:你是在谈论这个SearchQuerySet返回的内容,还是在使用Haystack视图搜索术语“Hello World”?我不是在搜索确切的术语,也不是在使用Haystack视图。简单搜索查询但请稍候。。。如果这三个标题被编入索引,它将只返回第一个标题是“Hello World”的歌曲,这是很正常的,不管它是EdgeNgramField。
sqs = SearchQuerySet().models(Song).filter(title='Hello World')