设置干草堆中的行数
Set count of rows in haystack
我使用 django-haystack。当我执行这段代码时:
sqs = SearchQuerySet().auto_query(q)
q_spell = sqs.spelling_suggestion()
results = SearchQuerySet().filter(SQ(content=q_spell) | SQ(content=q)).load_all()
在控制台中我看到的是这样的:
> 365645 [qtp1539768275-13] INFO org.apache.solr.core.SolrCore –
> [collection1] webapp=/solr path=/select/
> params={spellcheck=true&fl=*+score&start=**990**&q=*:*&spellcheck.count=1&spellcheck.collate=true&wt=json&fq=django_ct:(...)&**rows=10**}
> hits=2034 status=0 QTime=0
我如何计算行数,例如 1000?
Haystack 每次查询检索的项目数通过 HAYSTACK_ITERATOR_LOAD_PER_QUERY 控制,但如文档所述:
This is not used in the case of a slice on a SearchQuerySet, which already overrides the number of results pulled at once.
因此在查询集之后使用 [0:1000]
应该可以让您一次获得所有 1000 个结果。
我使用 django-haystack。当我执行这段代码时:
sqs = SearchQuerySet().auto_query(q)
q_spell = sqs.spelling_suggestion()
results = SearchQuerySet().filter(SQ(content=q_spell) | SQ(content=q)).load_all()
在控制台中我看到的是这样的:
> 365645 [qtp1539768275-13] INFO org.apache.solr.core.SolrCore –
> [collection1] webapp=/solr path=/select/
> params={spellcheck=true&fl=*+score&start=**990**&q=*:*&spellcheck.count=1&spellcheck.collate=true&wt=json&fq=django_ct:(...)&**rows=10**}
> hits=2034 status=0 QTime=0
我如何计算行数,例如 1000?
Haystack 每次查询检索的项目数通过 HAYSTACK_ITERATOR_LOAD_PER_QUERY 控制,但如文档所述:
This is not used in the case of a slice on a SearchQuerySet, which already overrides the number of results pulled at once.
因此在查询集之后使用 [0:1000]
应该可以让您一次获得所有 1000 个结果。