django-machina 搜索 returns 无结果
django-machina search returns no result
我已按照此 Tutorial 中给出的所有步骤进行操作,但我的项目的搜索功能无法正常工作。而 django-machina 给出的示例项目在搜索方面运行良好。那么有人可以告诉我缺少的东西是什么吗?我还重建并更新了索引。但我的搜索仍然没有给出任何结果。它始终是 0 个结果,没有错误。
当我 运行 重建索引命令时,我得到以下错误
python3 manage.py rebuild_index
/usr/local/lib/python3.8/site-packages/jose/backends/cryptography_backend.py:18: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes, int_to_bytes
WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
/usr/local/lib/python3.8/site-packages/haystack/backends/simple_backend.py:31 UserWarning: clear is not implemented in this backend
All documents removed.
Indexing 13 Posts
/usr/local/lib/python3.8/site-packages/haystack/backends/simple_backend.py:25 UserWarning: update is not implemented in this backend
您可以找到解决方案 here。添加设置后请执行 python3 manage.py update_index
或者你可以通过代码
from django.core import management
management.call_command('update_index')
我已按照此 Tutorial 中给出的所有步骤进行操作,但我的项目的搜索功能无法正常工作。而 django-machina 给出的示例项目在搜索方面运行良好。那么有人可以告诉我缺少的东西是什么吗?我还重建并更新了索引。但我的搜索仍然没有给出任何结果。它始终是 0 个结果,没有错误。
当我 运行 重建索引命令时,我得到以下错误
python3 manage.py rebuild_index
/usr/local/lib/python3.8/site-packages/jose/backends/cryptography_backend.py:18: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes, int_to_bytes
WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
/usr/local/lib/python3.8/site-packages/haystack/backends/simple_backend.py:31 UserWarning: clear is not implemented in this backend
All documents removed.
Indexing 13 Posts
/usr/local/lib/python3.8/site-packages/haystack/backends/simple_backend.py:25 UserWarning: update is not implemented in this backend
您可以找到解决方案 here。添加设置后请执行 python3 manage.py update_index
或者你可以通过代码
from django.core import management
management.call_command('update_index')