Skip to content

Commit

Permalink
使用whoosh之后解决了问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
zswj123 committed Jul 9, 2021
1 parent bb7b757 commit 8cc0dfe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions DRFHTutorial/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -128,8 +128,8 @@
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

HAYSTACK_CONNECTIONS = {
"default": {
# For Simple:
"ENGINE": "haystack.backends.simple_backend.SimpleEngine"
'default': {
'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
'PATH': os.path.join(os.path.dirname(os.path.dirname(__file__)), 'Whoosh'),
},
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
![](https://github.com/cs246810/DRFHTutorial/blob/master/api_test.png)

结果有点差强人意,确实出现了结果,但是,这里出现的说text为null的数据,显然我没有找到正确的使用drf_haystack
的方法。
的方法。

后来我换上whoosh之后,居然奇迹般的出现了结果。

![](https://github.com/cs246810/DRFHTutorial/blob/master/whoosh.png)
Binary file added whoosh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8cc0dfe

Please sign in to comment.