SOLR 与 haystack 查询没有结果,但数据确实存在
我有一个配置好的 SOLR 服务器,它对所有结果进行了索引。 查询所有结果确实给出了记录。
./manage.py shell
>>> from haystack.query import SearchQuerySet
>>> SearchQuerySet().all().count()
2086
>>> SearchQuerySet().all()[1000].result_top_level_category
u'tuinieren'
然而,当我开始查询这些记录时,我没有得到任何结果。
>>> SearchQuerySet().all().filter(result_top_level_category='tuinieren').count()
0
>>> SearchQuerySet().all().filter(result_top_level_category=u'tuinieren').count()
0
你能为我提供解决这个问题的线索或解决方案吗?
SOLR 架构由 manage.py build_solr_schema
生成。这是 result_top_level_category
字段的相关行:
<field name="result_top_level_category" type="string" indexed="false"
stored="true" multiValued="false" />
问题似乎是在 SOLR 架构更新后发生的;重新引入了另一个字段名称。该字段名在 all()
查询中返回。
I've got a configured SOLR server, which has all results indexed.
Querying all results does give records.
./manage.py shell
>>> from haystack.query import SearchQuerySet
>>> SearchQuerySet().all().count()
2086
>>> SearchQuerySet().all()[1000].result_top_level_category
u'tuinieren'
When I start querying for those records however, I got no results.
>>> SearchQuerySet().all().filter(result_top_level_category='tuinieren').count()
0
>>> SearchQuerySet().all().filter(result_top_level_category=u'tuinieren').count()
0
Could you give me a clue or solution to this problem?
The SOLR schema is generated by manage.py build_solr_schema
. This is the relevant line for the result_top_level_category
field:
<field name="result_top_level_category" type="string" indexed="false"
stored="true" multiValued="false" />
Te issues appear to have happened after the SOLR schema was updated; another fieldname was reintroduced. This fieldname is returned though in the all()
query.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时单独问一个问题就可以澄清!
查看 SOLR 架构文档 ( http://wiki.apache.org/solr/SchemaXml )很明显,该字段需要索引才能可查询或可排序。
现在可以查询特定字段。
Sometimes asking a question alone clarifies!
Looking at the SOLR schema documentation ( http://wiki.apache.org/solr/SchemaXml ) it's clear to be that the field needs to be indexed to be queryable, or sortable.
Querying specific fields now works.