如何在 haystack-solr 中获取搜索时间

发布于 2024-12-28 23:59:38 字数 73 浏览 2 评论 0原文

如何在后端使用 solr 获取在 haystack 中搜索查询所需的时间?我想获取这个时间并将其显示在我的模板上。与谷歌显示的类似。

How can I get the time it takes for a searching a query in haystack using solr at the backend? I want to get this time and display it on my template. Something similar to what google shows.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

分开我的手 2025-01-04 23:59:38

经过尽我所能的挖掘后,目前无法使用 Haystack 从 SOLR 访问查询时间(QTime)。

pysolr 对象附加了 QTime。
https://github.com/toastdriven/pysolr/blob/master/pysolr .py#L265

然而,Haystack 并未从对象中提取此信息。
https://github.com/toastdriven/django -haystack/blob/master/haystack/backends/solr_backend.py#L313

在 _process_results() 中 raw_results 是pysolr 对象但是您可以看到 qtime 没有返回。
https://github.com/toastdriven/django -haystack/blob/master/haystack/backends/solr_backend.py#L382

After some digging as best as I can work out it is not currently possible to access the query time (QTime) from SOLR using Haystack.

The pysolr object has the QTime attached to it.
https://github.com/toastdriven/pysolr/blob/master/pysolr.py#L265

However this information is not extracted from the object by Haystack.
https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/solr_backend.py#L313

In _process_results() raw_results is a pysolr object however you can see that qtime is not returned.
https://github.com/toastdriven/django-haystack/blob/master/haystack/backends/solr_backend.py#L382

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文